Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3 4 ... 9

Author Topic: [MOD] Different templates wherever you want (version independent)  (Read 42225 times)

mlab

  • Newbie
  • *
  • Karma: 1
  • Posts: 13
    • mlab.name
Re: [MOD] Different templates wherever you want
« Reply #15 on: October 21, 2007, 03:37:32 am »

ok. I have found the explanation.
It was my fault : a too speed copy/paste when I modified my old index.php  ::) Really sorry  :-[

And the new/second release of your explanations/comments on your code is clearer for me than the first one  8)

Thanks one more time for this MOD  8)
Logged

Joost

  • Guest
Re: [MOD] Different templates wherever you want
« Reply #16 on: October 21, 2007, 03:49:50 am »

Thanks for the encouraging words. I learn from any honest feedback. :) The result should be better code and comments.
Logged

sibas

  • Sr. Member
  • ****
  • Karma: 23
  • Posts: 451
    • www.simply4all.net
Re: [MOD] Different templates wherever you want
« Reply #17 on: October 21, 2007, 07:37:00 pm »

Hi there
I am really sorry if my questions mess somehow the understanding for your mod.
So far I donít try the answer you give me Joost, definitely I am going to try this week, and I let you know whatís going on.
Logged

Sasha

  • Hero Member
  • *****
  • Karma: 28
  • Posts: 938
    • cssanarchy.com
Re: [MOD] Different templates wherever you want
« Reply #18 on: October 25, 2007, 05:35:26 am »

Code: [Select]
<?php session_start(); include('snews.php');

function 
templates (){
$uri $_SERVER['REQUEST_URI'];
switch (true):
 
//-------------templates for pages should be listed beneath this comment.----------
 
case ($uri=='/'):
include ('frontpage.php'); break;

case ($uri == '/category/a-special-page/'):
include ('that-particular-page.php'); break;

//-------------TEMPLATES FOR CATEGORIES MUST BE LISTED BENEATH THIS COMMENT.----------

case (ereg('/a-specific-category/'$uri)): 
include ('show-off.php');break;

        case (
ereg('/another-category/'$uri)): 
include ('cool-template.php');break;

// Default template for everything else (always last):
default:
include ('everythingelse.php');
endswitch;
}
templates ();
?>

Joost let me ask you questions...!
If i have one new page named "mywork.php" and want to include category (formed in snews under categories) like "webdesign" what i need to do to include your mode.....?  i read your post but is so confusing for me  ???
Logged
Every morning, I get up and look through the 'Forbes' list of the richest people in America. If I'm not there, I go to work. | If you love your job, you haven't worked a day in your life. snews with ♥

Joost

  • Guest
Re: [MOD] Different templates wherever you want
« Reply #19 on: October 25, 2007, 06:50:58 am »

If I understand it well, mywork.php is a template and you want to use it to style the category 'Webdesign'.

First, you have to rename your current index.php, that is used site wide, to everythingelse.php and don't forget to delete
Code: [Select]
<?php session_start(); include('snews.php'); ?>(that code will be in the new index.php)

Second: Create the category you want to style (Webdesign). The uri that we need, can be found in the addressbar of the browser when visiting the category.  It will look like this: /webdesign/
Past the uri and the template name in the 'new' index.php code.

Your 'new' index.php would look like this:

Code: [Select]
<?php session_start(); include('snews.php');

function 
templates (){
$uri $_SERVER['REQUEST_URI'];
switch (true):

//----TEMPLATES FOR PAGES SHOULD BE LISTED BENEATH THIS COMMENT.----------

//(currently empty)

//----TEMPLATES FOR CATEGORIES MUST BE LISTED BENEATH THIS COMMENT.----------


        
case (ereg('/webdesign/'$uri)): 
include ('mywork.php');break;

//---- DEFAULT TEMPLATE FOR EVERYTHING ELSE (ALWAYS LAST)----------------------
default:
include ('everythingelse.php');
endswitch;
}
templates ();
?>


With this code, the 'dessert' design (I don't know its official name) works site wide and 'mywork' only for the category 'Webdesign'
« Last Edit: October 25, 2007, 06:53:48 am by Joost »
Logged

Sasha

  • Hero Member
  • *****
  • Karma: 28
  • Posts: 938
    • cssanarchy.com
Re: [MOD] Different templates wherever you want
« Reply #20 on: October 25, 2007, 07:44:52 am »

hm i use this mode but got strange problem ...if i click on my link mywork.php page is on home but link change in broswers bar and if i click second time same link page my work then works?/??????any sugestions?thank`s for your help.i need click link 2 times in order to work?

first click i got this http://www.site.com/mywork.php with home in
second click i got this http://www.site.com/webdesign and this works
« Last Edit: October 25, 2007, 07:51:55 am by Sasha »
Logged
Every morning, I get up and look through the 'Forbes' list of the richest people in America. If I'm not there, I go to work. | If you love your job, you haven't worked a day in your life. snews with ♥

Joost

  • Guest
Re: [MOD] Different templates wherever you want
« Reply #21 on: October 25, 2007, 07:51:46 am »

I don't understand what you mean Sasha. The mod is only supposed to switch templates, when going to a specific page or category.
Logged

Sasha

  • Hero Member
  • *****
  • Karma: 28
  • Posts: 938
    • cssanarchy.com
Re: [MOD] Different templates wherever you want
« Reply #22 on: October 25, 2007, 07:53:17 am »

can this mod show my article page created in snews?
Logged
Every morning, I get up and look through the 'Forbes' list of the richest people in America. If I'm not there, I go to work. | If you love your job, you haven't worked a day in your life. snews with ♥

Joost

  • Guest
Re: [MOD] Different templates wherever you want
« Reply #23 on: October 25, 2007, 07:54:18 am »

That's what it does. You create a page and add a styling.
Look. http;//www.site.com/mywork.php is not a page created in snews. It is a template
In default snews we never link to index.php, which is the default template.
« Last Edit: October 25, 2007, 07:57:56 am by Joost »
Logged

Sasha

  • Hero Member
  • *****
  • Karma: 28
  • Posts: 938
    • cssanarchy.com
Re: [MOD] Different templates wherever you want
« Reply #24 on: October 25, 2007, 07:58:49 am »

yes but i need click two times to get article to show if i click only one only changes i see in my broswer bar like www.site.com/mywork.php but no article show except page stay like home.if i click second time same link i got categories which work fine???so i have to click two times same link in order to work.that is not good...
Logged
Every morning, I get up and look through the 'Forbes' list of the richest people in America. If I'm not there, I go to work. | If you love your job, you haven't worked a day in your life. snews with ♥

Joost

  • Guest
Re: [MOD] Different templates wherever you want
« Reply #25 on: October 25, 2007, 08:04:20 am »

Have you made/hardcoded the link www.site.com/mywork.php yourself? If you have created the category webdesign in the admin panel, then you would be directed to http;//www.site.com/webdesign.
« Last Edit: October 25, 2007, 08:06:24 am by Joost »
Logged

Sasha

  • Hero Member
  • *****
  • Karma: 28
  • Posts: 938
    • cssanarchy.com
Re: [MOD] Different templates wherever you want
« Reply #26 on: October 25, 2007, 08:19:50 am »

oky link works now but mywork.php dont.if i click on link a got what i want but template stay same.i removed some part of template in mywork.php but template always show home templates with categories (works).
Logged
Every morning, I get up and look through the 'Forbes' list of the richest people in America. If I'm not there, I go to work. | If you love your job, you haven't worked a day in your life. snews with ♥

Joost

  • Guest
Re: [MOD] Different templates wherever you want
« Reply #27 on: October 25, 2007, 08:28:06 am »

When clickin on the link http;//www.site.com/webdesign it should show that specific category with the template myworks.
Logged

Sasha

  • Hero Member
  • *****
  • Karma: 28
  • Posts: 938
    • cssanarchy.com
Re: [MOD] Different templates wherever you want
« Reply #28 on: October 25, 2007, 08:44:23 am »

i know but somthing is not right...if i use site.com/mywork.php that  show template but not categorie,and if i use site.com/webdesign show categori but not template i mean show home template which is snews index.php
Logged
Every morning, I get up and look through the 'Forbes' list of the richest people in America. If I'm not there, I go to work. | If you love your job, you haven't worked a day in your life. snews with ♥

hyele

  • Newbie
  • *
  • Karma: 0
  • Posts: 44
Re: [MOD] Different templates wherever you want
« Reply #29 on: October 29, 2007, 02:35:43 pm »

Using this mod, if i understand...
i could also use a template for my home page.. (very interesting to me...)
and one for all the others pages???

thanks and best regard,
DOmenico
Logged
Pages: 1 [2] 3 4 ... 9