Jump to content

function...code to include


jimfog
 Share

Recommended Posts

I want to create a function where I will include code related to the head section of a webpage(meta tags etc...). Do you think it will cause any problems(whatever might that be)?

Link to comment
Share on other sites

i am not sure what you are asking. which type of problem are you expecting or refering?

Link to comment
Share on other sites

Take a look at the code below:

function output_head($title=false){?>       <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head>	    <title><?php $title ?></title>	 	    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />	    <link rel="stylesheet"  href="css/admingeneral.css"/>	    <script  type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js" ></script>	    <script type="text/javascript" src="js/js-code.js"></script>    </head><?php}

I have enclosed everything related to the head section in a function-which of course I am calling at some webpage of the application(not shown here). So, it is OK doing it this code or maybe is it better if the head section does not go in a function?

Link to comment
Share on other sites

ues \"

<?PHPfunction output_head($title=false){    return "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head>		    <title>".$title."</title>				    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />		    <link rel=\"stylesheet\"  href=\"css/admingeneral.css\"/>		    <script  type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js\" ></script>		    <script type=\"text/javascript\" src=\"js/js-code.js\"></script>    </head>";}echo output_head("test");?>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...