Avatar of J N
J N

asked on 

php domdocument vs php-html-generator vs another php html generator class

Hi,

I want to use php to standard html output from several ppl.

I was thinking of using a class similar to php-html-generator found on git ( https://github.com/Airmanbzh/php-html-generator ). Essentially this class would be slightly modified to create bootstrap 4 elements without having to set attributes continually.

Or is it a better idea to use the built-in domdocument class?

Thanks!
HTMLPHP

Avatar of undefined
Last Comment
gr8gonzo
SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of J N
J N

ASKER

basically, i wanted a way to standardize the html output and if i wanted to use a different css stylesheet i would only have to update the class.

I agree that these are both not preferred but a method to achieve the end goal.


this is a basic idea

class bootstrap_html{
	public $html = '';
	
	function panel( $classes = "primary" , $attr = ''){
		return '
			<div class"panel panel-'.$classes.'" '.$attr.'>
		
		
			</div>
		';
	}
}

Open in new window



then the user would just instantiate the class and use it to generate the content  - obviously this is wayyyyyyyy oversimplified but i hope it gets the point across
SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
ASKER CERTIFIED SOLUTION
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of J N
J N

ASKER

Hi,

Thank guys

I am more concerned because i am relying on a third party (ie bootstrap) to perform the bulk of the css. If they make major changes like they did from 3  to 4 then rewriting classes/html or adding the old classes to the stylesheets would need to occur.

Is there an approach that could minimize this?
Avatar of J N
J N

ASKER

Obviously not relying on a third party is an option
SOLUTION
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo