I am facing a strange problem.
My PHP page has following code.
echo "<div id='page_$i' class='layout_pages'>".eval('?>' . $layouts[$i]. '<?php ')."</div>";
Here $i is my iterator and $layouts is an Array which have multiple layouts fetched from database in it. Some layouts have PHP code in them. That’s why I am using eval function.
Now problem is that HTML output of this code is something like that
<div id='page_$i' class='layout_pages'></div>
//Layout output goes here
Ideally layout out should be wrapped in this DIV. But Div starts and closes before layout. Can you suggest me some good solution.
[Solved]
Well mates, I solved this issue by making following changes in code. Rather showing all data in one echo statement. I used multiple echo commands and everything is fine now. Thanks a lot for your suggestions.
<div id='page_<?php echo $i; ?>' class='layout_pages' ><?php echo eval('?>' . $layouts[$i]. '<?php '); ?></div>;
As i dun have 100 points. So cant answer my own question. That’s why i am editing my question 🙂
The rogue eval function in there is probably the culprit, I would recommend doing it like this instead: