Search code examples
phplistechohybrid-mobile-app

Problems with creating a list in PHP


Can someone tell me what's wrong with my list? It's my first time creating a list in PHP and an error came up when running it. The error said:

"Parse error: syntax error, unexpected 'col' (T_STRING), expecting ')' in /Applications/XAMPP/xamppfiles/htdocs/Pinder/CMS/event.php on line 410"

I want to be able to have 2 containers with a gap between them. which is why I've went for the col-md 6,2,6.

Here is my code:

// List
      echo_lines(array(
        "<ul>", 
        "<div="col-md-6">""</div>",
        "<div="col-md-2">""</div>",
        "<div="col-md-6">""</div>",
        "</ul>",
      ));

Solution

  • You have to escape the double quotes in your code like so (also note the dots . which concatenate the string):

    // List
          echo_lines(array(
            "<ul>", 
            "<div class=\"col-md-6\">" . "</div>",
            "<div class=\"col-md-2\">" . "</div>",
            "<div class=\"col-md-6\">" . "</div>",
            "</ul>",
          ));
    

    As you can see, I have also added class in front of the equal-sign... I think you missed that one as well...