Can not output a variabel in html

Hello,

i trie to output html over the ethercard library, it works but when i add some variabels i get a error

GaragePoort:124: error: array must be initialized with a brace-enclosed initializer

exit status 1
initializer fails to determine size of ‘__c’

How can i solf this problem? after searching the form i did nof tind a solution

Greathings

bfill.emit_p(PSTR( “$F”
“”
“”
“GaragePoort”
“”
“”

Poortschakeling




“Poort Links (klio)”
“”
“”
“”
“”


“Poort Rechts (Sharan)”
“”
“”
“”
“”


Buitenverlichting ($F)

“LATER”
“”
“”),
http_OK,
PoortLinksOpen?PSTR(“Sluiten”):PSTR(“Openenen”),
PoortLinksOpen?PSTR(“Sluiten”):PSTR(“Openenen”),
PoortRechtsOpen?PSTR(“Sluiten”):PSTR(“Openenen”),
PoortRechtsOpen?PSTR(“Sluiten”):PSTR(“Openenen”),

PSTR(year()));

Post complete code and use code tags (that’s the </> button)!

It would be far simpler to get a W5x00 based Ethernet shield.

Sorry this is the full code, i have the ethernet module from a arduino pack/kit

/*=== libraries ===*/
  #include <EtherCard.h>
  #include <Time.h>
  #include <TimeLib.h>  

/*=== instellingen ===*/
  /*internet*/
  static byte ntpServer[] = {216,239,35,0}; //ntp.xs4all.nl but you can cange in any public ntp server.
  uint8_t ntpMyPort = 8888;
  long timeZoneOffset = 3600L; //Winter (original) time Europe
  
  static byte myip[] = { 192,168,0,200 }; // ip adders van de ethernet module
  static byte gwip[] = { 192,168,0,1 }; // ip adders van de defalt gateway
  static byte dnsip[] = { 192,168,0,1 }; // ip adders van de dns server
  static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 }; // MAC addres van de ethernet module 
  byte Ethernet::buffer[1000]; // TCPIP buffer ruimte
  BufferFiller bfill;
  
  /*arduino pinnen*/
  #define PoortLinks 3  // relay (open|dicht) van de linkerpoort
  #define PoortRechts 4  // relay (open|dicht) van de rechterpoort
  #define BuitenLichten 5  // relay (aan|uit) van de buitenverlichting
  //#define¨Open 5  // open relay
  
  /*arduino variabels*/
  int WaitCount = 0;
  bool PoortLinksOpen = false;
  bool PoortRechtsOpen = false;

  /*http headers*/
  const char http_OK[] PROGMEM =  "HTTP/1.0 200 OK\r\n"
                                  "Content-Type: text/html\r\n"
                                  "Pragma: no-cache\r\n\r\n";
  
  const char http_Unauthorized[] PROGMEM =  "HTTP/1.0 401 Unauthorized\r\n"
                                            "Content-Type: text/html\r\n\r\n"
                                            "<h1>401 Unauthorized</h1>";

/*=== timezone ophalen ===*/
  unsigned long getNtpTime() {
  unsigned long timeFromNTP;
  const unsigned long seventy_years = 2208988800UL;
  int i = 60; //Number of attempts
  Serial.println("NTP request sent");
  while(i > 0) {
  ether.ntpRequest(ntpServer, ntpMyPort);
      Serial.print("."); //Each dot is a NTP request
      word length = ether.packetReceive();
      ether.packetLoop(length);
      if(length > 0 && ether.ntpProcessAnswer(&timeFromNTP,ntpMyPort)) {
        Serial.println();
        Serial.println("NTP reply received");
        return timeFromNTP - seventy_years + timeZoneOffset;      
      }
      delay(500);
      i--;
    }
  Serial.println();
  Serial.println("NTP reply failed");
  return 0;
}

/*=== alles klaarmaken om op te starten ===*/
  void setup(){
    /*serial verbinding opzetten*/
    Serial.begin(57600);
    Serial.println("Serialverbinding van PoortArduino");
    Serial.println("(c) 2017 Christophe Van Dooren");

    /*pinmode in orde brengen*/
    pinMode(PoortLinks, OUTPUT);      // poort L
    digitalWrite(PoortLinks, HIGH); 
    pinMode(PoortRechts, OUTPUT);      // poort R
    digitalWrite(PoortRechts, HIGH); 
    pinMode(BuitenLichten, OUTPUT);      // Licht
    digitalWrite(BuitenLichten, HIGH); 

    /*internetverbinding opzetten*/
    if (ether.begin(sizeof Ethernet::buffer, mymac) == 0) {
      Serial.println( "[ERROR]Kan geen verbinding maken met de internetmodule");
    }
    ether.staticSetup(myip, gwip, dnsip);
    ether.printIp("IP:  ", ether.myip);
    ether.printIp("GW:  ", ether.gwip);  
    ether.printIp("DNS: ", ether.dnsip);
  }

/*=== index (homepage) opbouwen ===*/
  void index()
  {
     bfill.emit_p(PSTR( "$F"
                        "<html>"
                          "<head>"
                            "<title>GaragePoort</title>"
                          "</head>"
                          "<body>"
                            "<h3>Poortschakeling</h3>"
                            "<div>"
                              "<div style='width:50%;float:left;text-align:center'>"
                                "Poort Links (klio)"
                                "<form>"
                                  "<input type='hidden' name='plinks' value='$F'>"
                                  "<input type='submit' value='$F'>"
                                "</form>"
                              "</div>"
                              "<div style='width: 50%; float:right;text-align:center;'>"
                                "Poort Rechts (Sharan)"
                                "<form>"
                                  "<input type='hidden' name='prechts' value='$F'>"
                                  "<input type='submit' value='$F'>"
                                "</form>"
                              "</div>"
                              "<div style='clear:both'></div>"
                            "</div>"
                            "<h3>Buitenverlichting ($F)</h3>"
                            "LATER"
                          "</body>"
                        "</html>"), 
                        http_OK, 
                        PoortLinksOpen?PSTR("Sluiten"):PSTR("Openenen"), 
                        PoortLinksOpen?PSTR("Sluiten"):PSTR("Openenen"),
                        PoortRechtsOpen?PSTR("Sluiten"):PSTR("Openenen"),
                        PoortRechtsOpen?PSTR("Sluiten"):PSTR("Openenen"),
                        PSTR(year()));
  }

/*=== effectieve schakelaar voor de poort ===*/
void PoortSchakeling(int pin) {
  digitalWrite(pin, LOW); 
  delay(1000);
  digitalWrite(pin, HIGH); 
  WaitCount = 2000;
}

/*=== programma doorlopen ===*/
  void loop(){
    /*Wachten op inkomende oproep, negeer inhoudt*/
    word len = ether.packetReceive();
    word pos = ether.packetLoop(len); 
    if (pos) {   
      delay(1);   // nodig voor het system
      bfill = ether.tcpOffset();
      char *data = (char *) Ethernet::buffer + pos;
      if (strncmp("GET /", data, 5) != 0) { //kijken of het een GET request was
        bfill.emit_p(http_Unauthorized); // geen GET request dus fout protocol
      } else {
          data += 5;
          if(WaitCount == 0) {
            if(strncmp("?plinks=Openenen ", data, 17) == 0) {
              /*Open Linkerpoort*/
              PoortSchakeling(PoortLinks);
              PoortLinksOpen = true;
            } else if (strncmp("?plinks=Sluiten ", data, 16) == 0) {
              /*Sluit Linkerpoort*/
              PoortSchakeling(PoortLinks);
              PoortLinksOpen = false;
            } else if(strncmp("?prechts=Openenen ", data, 17) == 0) {
              /*Open Rechterpoort*/
              PoortSchakeling(PoortRechts);
              PoortRechtsOpen = true;
            } else if (strncmp("?prechts=Sluiten ", data, 16) == 0) {
              /*Sluit Rechterpoort*/
              PoortSchakeling(PoortRechts);
              PoortRechtsOpen = false;
            }
          }

          /*tijd vragen*/
          if(year() == 1970) {
            setTime(getNtpTime());
          }
          index();
       }
       
       ether.httpServerReply(bfill.position());    // send http response
   }

   if(WaitCount != 0) {
    WaitCount = WaitCount - 1;
   }
 }

If you replace this line

                        PSTR(year()));

by

                        year());

It will at least compile.

But you probably have to replace the last $F by a $D to make it work.