Reputation:
I have a problem, when I try to echo
a div class. When I put the following code in my template, it detects only the closing tag and not the opening. So, my webpage is ruined:
<div id="container">
<div id="pagina_text">
{{ CONTENT }}
<br />
<div class="rw-ui-container"></div>
<br /><br />
<?php
var_dump($_GET['categorie']);
if(isset($_GET['categorie']) && $_GET['categorie'] === "navigatie_bar")
{
echo "<div class=\"fb-comments\" data-href=\"http://alledaagsetips.nl\" data-numposts=\"10\" data-colorscheme=\"light\"></div>";
}
?>
</div> <!-- end pagina_text -->
</div><!-- end container -->
Does someone know what am I doing wrong?
Upvotes: 1
Views: 828
Reputation: 23883
Replace single quote with double quote.
Change
<?php
if(strcmp($_GET['categorie'], "navigatie_bar") != 0)
{
echo '<div class="fb-comments" data-href="http://alledaagsetips.nl" data-numposts="10" data-colorscheme="light"></div>';
}
?>
to this
<?php
if(strcmp($_GET['categorie'], 'navigatie_bar') != 0)
{
echo "<div class='fb-comments' data-href='http://alledaagsetips.nl' data-numposts='10' data-colorscheme='light'></div>";
}
?>
Upvotes: 1
Reputation: 371
<div id="container">
<div id="pagina_text">
{{ CONTENT }}
<br>
<div class="rw-ui-container"></div>
<br><br>
<?php if ( ! empty($_REQUEST['categorie']) and $_REQUEST['categorie'] == 'navigatie_bar'): ?>
<div class="fb-comments" data-href="http://alledaagsetips.nl" data-numposts="10" data-colorscheme="light"></div>
<?php endif; ?>
</div> <!-- end pagina_text -->
</div><!-- end container -->
Upvotes: 0
Reputation: 4419
replace single quotes with double and vice versa
echo "<div class='fb-comments' data-href='http://alledaagsetips.nl' data-numposts='10' data-colorscheme='light'></div>";
or use the same for all but with backslash, just to not get confused
echo "<div class=\"fb-comments\" data-href=\"http://alledaagsetips.nl\" data-numposts=\"10\" data-colorscheme=\"light\"></div>";
Upvotes: 0
Reputation: 1505
Are you sure the "IF" condition is working?
Perhaps with a simple string comparison like so :
<?php
if(isset($_GET['categorie']) && $_GET['categorie'] === "navigatie_bar") {
echo '<div class="fb-comments" data-href="http://alledaagsetips.nl" data-numposts="10" data-colorscheme="light"></div>';
}
?>
Upvotes: 0