nagalenoj Posted March 13, 2009 Share Posted March 13, 2009 Dear friends, Is there any module available in php to create html elements. I don't know much about HTML. So, Using php i would like to create elements. For example, Calling a function like the following will create a p tag with the given attributes. Create_p("class","id","name") Link to comment https://forums.phpfreaks.com/topic/149221-generate-html-through-php/ Share on other sites More sharing options...
ricmetal Posted March 13, 2009 Share Posted March 13, 2009 well, you could function createP(class,id,name) { echo "<p class='".class."' id='".id."' name='".name."'>"; } something like that Link to comment https://forums.phpfreaks.com/topic/149221-generate-html-through-php/#findComment-783626 Share on other sites More sharing options...
dgoosens Posted March 13, 2009 Share Posted March 13, 2009 just found this on the web http://phphtmltemplate.sourceforge.net/ I think this is more or less what you are looking for... otherwise, you can also generate a HTML file by using the XMLWriter class but... I think it would be easier to just learn the basics of HTML... as it is rather easy Link to comment https://forums.phpfreaks.com/topic/149221-generate-html-through-php/#findComment-783627 Share on other sites More sharing options...
grissom Posted March 13, 2009 Share Posted March 13, 2009 I'm not sure exactly what you are looking to achieve, but to write HTML using PHP you could use the ECHO command. Something like (BTW this was written up on the quick, not tested !) function create_p('$class','$id','$name') { echo "<P NAME = '$name' ID = '$id' CLASS = '$class'>"; } Or something like that ! A more experienced programmer might spot a syntax error in the above, like I say I haven't tested it. Link to comment https://forums.phpfreaks.com/topic/149221-generate-html-through-php/#findComment-783628 Share on other sites More sharing options...
kenrbnsn Posted March 13, 2009 Share Posted March 13, 2009 My suggestion is for the OP to learn HTML. You can not create good web sites with PHP unless you know HTML. Ken Link to comment https://forums.phpfreaks.com/topic/149221-generate-html-through-php/#findComment-783665 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.