1
technigrafa
Apply extra stylesheet if no module is being used

I'm redesigning the our website:

http://www.technigrafa.com

And I am trying to get it to validate by W3C and there is one problem I can't overcome. I am wrapping XOOPS around a PHP page for the home page and I have to include this stylesheet below in the PHP home page because I don't want to load it on every other page if it's not necessary:

<link rel="stylesheet" media="screen" href="/themes/technigrafa2/home.css" type="text/css" />


The problem is since this is in the PHP page that is being wrapped with the XOOPS header, this puts that line outside of the head of the document, which W3C doesn't like. Is there some code I can use in the XOOPS theme page that will check to see if any module is being loaded and if not, use this style sheet above?

2
technigrafa
Re: Apply extra stylesheet if no module is being used

This should do the trick, but the XOOPS theme doesn't seem to be running this code for some reason:

<{php}> 
 if (
$_SERVER['PHP_SELF'] == 'index.php') { 
  echo 
'<link rel="stylesheet" media="screen" href="<{$xoops_imageurl}>home.css" type="text/css" />'
 } 
<{/
php}>



Anyone have any ideas?

3
WarDick
Re: Apply extra stylesheet if no module is being used
  • 2006/10/3 0:07

  • WarDick

  • Just can't stay away

  • Posts: 890

  • Since: 2003/9/13


I believe you could accomplish this with the Wraps module or the TinyD module from from GIJoe.
Urging XOOPS to be the Best It Can Be.
Richard......

4
technigrafa
Re: Apply extra stylesheet if no module is being used

Thanks,

I took a look at the Wraps module and it appears to just wrap XOOPS around HTML pages. I am already doing that in my php page though - that's not my problem. I just need to get the extra CSS call into the <HEAD> IF the wrapped page is being displayed and use the regular CSS on all other pages.

And TinyD is just a content module, if I remember right, and we're already using the Content module. Even if we put the code from our wrap into a content editor, we still won't be able to reassign the margin width of the content area and still be W3C compliant.

Any other ideas?

5
wizanda
Re: Apply extra stylesheet if no module is being used
  • 2006/10/3 16:00

  • wizanda

  • Home away from home

  • Posts: 1585

  • Since: 2004/3/21


Ok two options 1 is add it in the theme for all as a CSS link...

The other is more complicated and has been done in CBB where the
$module_header = '$fredblogs';
$fredblogs = ' ';

Something like that anyways have a look how it has been done in CBB and also somewhere on the forum... i needed to do this for the Bible module i think it was; yet didn't fully finnish it, adding the CSS into the header...as decided it was easier, just to add it into my themes....

yet given that I still need to understand this a bit better my self as currently multimenu still upsets me, when I have un-neeeded CSS calls in the middle of the page causing a w3c error..I do like 100% not less if i can.... So at some point will work out how to direct this properly, so that any variable can be easily added to the module_header which sits in your theme already for this purpose...

If you do manage to do it in PHP like that; inform us of the process please so I can fix some of the modules I wanted to...may spend a day working it out...if you don't...yet shouldn't be that hard as it is already in CBB and others modules who know what they are doing a bit more then me...

6
technigrafa
Re: Apply extra stylesheet if no module is being used

Thanks to marcan from Inbox International, I have the solution:

Change the top XOOPS wrap code in my index.php file from

<?php
include("mainfile.php");
include(
"header.php");
$xoopsOption['show_rblock'] = 1;
?>



to:

<?php
 
include("mainfile.php");
 include(
"header.php");
 
$xoopsTpl->assign('index_css''<link rel="stylesheet" media="screen" href="' XOOPS_THEME_URL.'/'.$xoopsConfig['theme_set'].'/home.css" type="text/css" />');
 
$xoopsOption['show_rblock'] = 1;
 
?>


And in my theme file put in <{$index_css}> where I want the home.css file to be loaded.

Hope this helps someone out there. I'm enjoying my new 100% HTML W3C compliant home page!

7
JCDunnart
Re: Apply extra stylesheet if no module is being used
  • 2006/10/3 19:24

  • JCDunnart

  • Not too shy to talk

  • Posts: 114

  • Since: 2006/7/1 5


In your PHP file after the inclusion of header.php you can use:

(XOOPS 2.0.15)
$xoTheme->addStylesheet('home.css');


(XOOPS 2.2.4)
$xoopsTpl->assign('xoops_module_header''<link rel="stylesheet" type="text/css" media="screen" href="'.XOOPS_THEME_URL.'/'.$xoopsConfig['theme_set'].'/home.css" />');


You don't need to add any code to your theme file.

8
technigrafa
Re: Apply extra stylesheet if no module is being used

But if you do this, the CSS inclusion will be outside of the HEAD of the document, thus rendering the page not W3C compliant, won't it? You have to somehow get that line inside the HEAD which is in the theme file.

The above method I posted works great for me, but many thanks for your help!

9
JCDunnart
Re: Apply extra stylesheet if no module is being used
  • 2006/10/3 20:04

  • JCDunnart

  • Not too shy to talk

  • Posts: 114

  • Since: 2006/7/1 5


The code I posted is the correct XOOPS way of adding script inside the HEAD.

The other way will work of course, but it's a complicated way of doing something simple

10
technigrafa
Re: Apply extra stylesheet if no module is being used

I tried it out and sure enough, you are absolutely correct. That way works great too!

Thanks!

Login

Who's Online

192 user(s) are online (103 user(s) are browsing Support Forums)


Members: 0


Guests: 192


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits