Template Head-content include order

Use GitHub to post bug reports and error descriptions for phpwcms. Describe your problem detailed!
Locked
LANtastic
Posts: 73
Joined: Sun 22. Feb 2004, 13:11
Location: Germany

Template Head-content include order

Post by LANtastic »

Not sure if it is an bug or not, but :

If you use user stylesheets and include them in the head of a template, then if you call that page in a browser you see this :

Code: Select all

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
---- your head content goes here ----
<script src="./phpwcms_template/inc_js/frontend.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="./phpwcms_template/inc_css/frontend.css" />
</head>
But I think it would be more useful to change the order of the included head content.

Like this :

Code: Select all

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<script src="./phpwcms_template/inc_js/frontend.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="./phpwcms_template/inc_css/frontend.css" />
---- your head content goes here ----
</head>
This has the advantage, that you can overwrite styles, setting, .... that have been defined as default.

For example if you use stylesheets:
I want for ALL pages, that HR-Tags are not visible.
All pages, except one page.

In frontend.css I defined :
hr {display:none}

to overwrite this, I would need to define a 2nd stylesheet defining :

hr {display:block}

So the old setting of none-displaying HR Tags will be overwritten only when I put a link in the head of my template pointing to the new stylesheet.
Theoretical ...

But as phpWCMS includes all head content before pointing to user Head Content .... it doesn't work.
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Re: Template Head-content include order

Post by DeXXus »

LANtastic wrote:But as phpWCMS includes all head content before pointing to user Head Content .... it doesn't work.
Have you tried altering the code sequence as an experiment?? I think this is where the magic happens in "index.php":

Code: Select all

<head>
<title><?php echo $content["pagetitle"] ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo PHPWCMS_CHARSET ?>">
<?php echo $block["htmlhead"] ?>
<script src="<?php echo ".".$phpwcms["templates"] ?>inc_js/frontend.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="<?php echo ".".$phpwcms["templates"]."inc_css/".$block["css"] ?>">
</head>
That would make it:

Code: Select all

<head>
<title><?php echo $content["pagetitle"] ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo PHPWCMS_CHARSET ?>">
<script src="<?php echo ".".$phpwcms["templates"] ?>inc_js/frontend.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="<?php echo ".".$phpwcms["templates"]."inc_css/".$block["css"] ?>">
<?php echo $block["htmlhead"] ?>
</head>
LANtastic
Posts: 73
Joined: Sun 22. Feb 2004, 13:11
Location: Germany

Post by LANtastic »

Ouch .... that one did it .... thanks ....

In german we call it "Ein Brett vor dem Kopf haben"

Please do not ask me to translate this :) It won't make any sense
It's something like "to be a blockhead" .... but translatet 1:1 german:english it means : "To have a plank in front of your head" 8)
Locked