Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Dynamic CSS?  (Read 1852 times)

sibas

  • Sr. Member
  • ****
  • Karma: 23
  • Posts: 451
    • www.simply4all.net
Dynamic CSS?
« on: October 06, 2007, 03:24:47 pm »

Hi, I like to have dynamic CSS in articles
My idea is to have one extra CSS where point to an empty CSS,
In article I am go use [break] exactly after the title and when someone goes to read more I want to print in extra CSS the name of specific article
For example

<link rel="stylesheet" type="text/css" href="css/basic.css" media="screen" />
<link rel="stylesheet" type="text/css" href="css/empty.css" />

Say we have one article with title “article1”
and when someone click to clickable title or read more then I want to print and change empty.css to aricle1.css
So like this when someone goes to read full the article page have this one
<link rel="stylesheet" type="text/css" href="css/aricle1.css" />

I thing is easy this, if some how read the name of article and prints to CSS
But I have no clue how to do this!!
Any idea how to try.
Logged

Joost

  • Guest
Dynamic stylesheet: Only for created pages and articles
« Reply #1 on: October 06, 2007, 10:28:53 pm »

Not sure what you mean with 'empty css'.

Here is a little function. It works only on created pages and articles. Not on category, contact, home, etc.

Code: [Select]
<?php
function style(){
$style get_id('article');
if (!empty ($style)) {
echo '<link rel="stylesheet" type="text/css" href="css/'.$style.'.css" />';
}
}
?>

insert into index.php the following below <link rel="stylesheet" type="text/css" href="css/basic.css" media="screen" /> :
Code: [Select]
<?php style();?>
Logged

sibas

  • Sr. Member
  • ****
  • Karma: 23
  • Posts: 451
    • www.simply4all.net
Re: Dynamic CSS?
« Reply #2 on: October 07, 2007, 08:25:17 pm »

Thank you Joost
I am going to try and let you know
Logged