Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: different layout at frontpage  (Read 8604 times)

satsilem

  • Newbie
  • *
  • Karma: 0
  • Posts: 10
different layout at frontpage
« on: June 14, 2006, 08:17:08 AM »

Hello to every body.

I want to ask if there is any way to have one layout for your home page and then another one for your articles,

maybe by using conditional case in php?

Thanks in advance

Note: Neewbie
Logged

Mika

  • Hero Member
  • *****
  • Karma: 9
  • Posts: 1377
    • http://www.ni5ni6.com/
different layout at frontpage
« Reply #1 on: June 14, 2006, 09:55:18 AM »

you should create different css layouts, one for your home page, and other for articles and then switch them using javascript or php
Logged
http://www.ni5ni6.com/ - Tutorials, Mods and How-To's about sNews CMS
sNews 1.6 Developers Edition - commented sNews 1.6 version

satsilem

  • Newbie
  • *
  • Karma: 0
  • Posts: 10
different layout at frontpage
« Reply #2 on: June 14, 2006, 10:35:37 AM »

well I know how to handle css but which is the best way to change the layout using php.

for example: at index.php file should I create an if statement? and what should the condition should look in order to change the layout when the articles are viewed?

Sorry but I only recently discovered the world of php, so I don;t realy know much about this

thank you for the reply
Logged

Mika

  • Hero Member
  • *****
  • Karma: 9
  • Posts: 1377
    • http://www.ni5ni6.com/
different layout at frontpage
« Reply #3 on: June 14, 2006, 12:13:39 PM »

unless you don't want to wait for 1.5 to arrive (i think...hope ;) ... something similar will be used there), try this:

- index.php (sNews1.4 standard edition)

disclaimer: this snippet is just an example and should not be used without basic to intermediate knowledge of php. please visit http://www.php.net for more info on how to handle $_GET requests safely
Quote
...
//comment or delete the existing style in the tag


//BASIC STYLE SWITCHER
$css = $_GET['style'];
if ($css == 'index')

//make a new style sheet index_style.css and put it into images folder
{$your_style = 'images/index_style.css';}
elseif ($css == 'sNews')
{$your_style = 'images/style.css';}
?>




index | sNews
...
i presume that you also want to change the contents of your site, along with it's style, eh? :D
this is how it can be done:
Quote







//BASIC CONTENT SWITCHER
if ($css == 'index')
{echo 'your-site-content-here';}
else
{center(4);}
?>


...
Logged
http://www.ni5ni6.com/ - Tutorials, Mods and How-To's about sNews CMS
sNews 1.6 Developers Edition - commented sNews 1.6 version

satsilem

  • Newbie
  • *
  • Karma: 0
  • Posts: 10
different layout at frontpage
« Reply #4 on: June 15, 2006, 09:07:04 AM »

Yes this is a solution but what i realy whant to do is something like this:


if (page == index.php)
{show the firstpage content with tree columns layout}

elseif (page == seftitle of an article)
{show the article content without the third column}


When I have sef titles, I cant use the variable 'id' for the if statment, so what can i do?

Thanks for your replies
Logged

Luka

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 36
  • Posts: 1716
    • http://www.snewscms.com
Logged

satsilem

  • Newbie
  • *
  • Karma: 0
  • Posts: 10
different layout at frontpage
« Reply #6 on: June 15, 2006, 10:12:12 AM »

It is working!!!

Thanks again for the replies
Logged

Mika

  • Hero Member
  • *****
  • Karma: 9
  • Posts: 1377
    • http://www.ni5ni6.com/
different layout at frontpage
« Reply #7 on: June 15, 2006, 10:50:01 AM »

cool... if you have it online, please give us a link to see how are you doing so far, eh? ;)
Logged
http://www.ni5ni6.com/ - Tutorials, Mods and How-To's about sNews CMS
sNews 1.6 Developers Edition - commented sNews 1.6 version