I'll use a general formula from my old answer First-degree spline interpolation problem
$$s=\frac{y_1+y_n}{2}+\sum_{j=1}^{n}c_j\vert x-x_j\vert.$$
Let's get rid of your index $i$ for now by setting $2=i$, hence $1=i-1$ and $3=i+1.$ So we're going to find $s(x)=\phi_2(x).$ You can bring back your index $i$ in the final expression.
In terms of that formula your case is: $n=3$; $y_1=0=y_3$; $y_2=1.$ The coefficients will be: $d_1=\tfrac{1}{x_2-x_1}$, $d_2=\tfrac{-1}{x_3-x_2}$; $c_1=\tfrac12 d_1$, $c_2=\tfrac12 (d_2-d_1)$, $c_3=-\tfrac12 d_2$. Let's start plugging all that into the formula:
$$\phi_2(x)=\tfrac12 \left(d_1\vert x-x_1\vert+(d_2-d_1)\vert x-x_2\vert-d_2\vert x-x_3\vert\right)$$
Further expanding the coefficients:
$$\phi_2(x)=\tfrac12 \left(\frac{\vert x-x_1\vert}{x_2-x_1}-\frac{(x_3-x_1)\vert x-x_2\vert}{(x_3-x_2)(x_2-x_1)}+\frac{\vert x-x_3\vert}{x_3-x_2}\right)$$
Finally,
$$\phi_i(x)=\tfrac12 \left(\frac{\vert x-x_{i-1}\vert}{x_i-x_{i-1}}-\frac{(x_{i+1}-x_{i-1})\vert x-x_i\vert}{(x_{i+1}-x_i)(x_i-x_{i-1})}+\frac{\vert x-x_{i+1}\vert}{x_{i+1}-x_i}\right)$$