I’m looking for a better way to generate dynamic html from php.
Before I would do something like this:
//generate.php
for(...)
{
$markup .= '<a id="'.$i.'">link'.$i.'</a>';
}
This is really ugly, and I would much prefer not to have to define my markup inline in php strings.
I am looking for the functionality of include "markup.php";, but I need to be able to store the result into a string, and not output it right away. Something like below would be excellent.
//generate.php
for(...)
{
$markup .= include "markup.php";
}
//markup.php
<a id="<?=$i?>">link<?=$i?></a>
Similar:
- Web User Control as an Applet in HTML Page Hello World, I have a web user control that actually takes a zipcode and based on that brings all the store locations. I am using...
- Clean up user input from unwanted HTML in a Spring web application I need to tidy user input in a web application so that I remove certain HTML-tags and encode < to > etc. I’ve made a...
- Storing HTML formatted text in database I am building a web site similar to Craigslist. I would like to know how to store the html formatted text (bold / italics /...
- Immutable Dot Net strings I usually define my string variables in vb.net as Dim f_sName as string=String.Empty f_sName = "foo" Given the immutable nature of strings in .net, is...
- ASP.NET and HTML 5 Questions I'm looking at buidling my site using HTML 5 as the default markup language. and including some jQuery functionality. Do we know if ASP.NET 3.5 currently...