string format replace by value in character in snprintf

I have the following function piece of cake in my ESP8266 based NodeMCU:

snprintf ( temp, 800,
"\

\ \ NodeMCU DHT11 Sensor \and Relay Board\ \ body { background-color: #cccccc; font-family: Arial, Helvetica, Sans-Serif; Color: #000088; }\ li { margin: 10px 0;}\ \ \ \

Hello from NodeMCU!

\

Temperature: %02d ℃ \ Humidity: %2d %

    \
  1. Turn Relay 1 On\/Off\
  2. Turn Relay 2 On\/Off
\

Uptime: %02d:%02d:%02d

\ \ ", t, h, !digitalRead(5), !digitalRead(4), hr, min % 60, sec % 60 ); if I try to use ternary operator like shown below , it freezes and doesn't work

snprintf ( temp, 800,
"\

\ \ NodeMCU DHT11 Sensor \and Relay Board\ \ body { background-color: #cccccc; font-family: Arial, Helvetica, Sans-Serif; Color: #000088; }\ li { margin: 10px 0;}\ \ \ \

Hello from NodeMCU!

\

Temperature: %02d ℃ \ Humidity: %2d %

    \
  1. Turn Relay 1 %s\
  2. Turn Relay 2 %s
\

Uptime: %02d:%02d:%02d

\ \ ", t, h, !digitalRead(5), !digitalRead(5), (digitalRead(5) ? "Off" : "On"), (digitalRead(4) ? "Off" : "On") hr, min % 60, sec % 60 );

Please read Nick Gammon's post at the top of the Forum on the proper way to post code using code tags.

             t, 
             h, 
             !digitalRead(5), 
             !digitalRead(5), 
            (digitalRead(5) ? "Off" : "On"),
            (digitalRead(4) ? "Off" : "On")
             hr, min % 60, sec % 60

You have ordered the prameters badly, you are reading a wrong port

             t, 
             h, 
             !digitalRead(5), (digitalRead(5) ? "Off" : "On"),
             !digitalRead(4), (digitalRead(4) ? "Off" : "On")
             hr, min % 60, sec % 60

Thank you so much Whandall, some times I am blind to spot tiny bits . I was seeing &5 as %d.