Alternative to storing html in php strings

Posted in dotnet, vb, vb.net | No Comments »

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:

  1. 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...
  2. 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 &gt etc. I’ve made a...
  3. 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 /...
  4. 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...
  5. 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...

Leave a Reply