Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: User additional "startpage" besides index.php  (Read 5572 times)

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
User additional "startpage" besides index.php
« on: November 22, 2009, 04:19:50 PM »

Hey... I have tried a number of times but can't just fix this...

The root index.php looks like this:

Code: [Select]
<?php session_start();
include (
'config.php'); // module's configuratuion file within the site root

# The site's template script & function-calls are located in each template folder's index.php file.
if(file_exists('templates/'.s('template').'/index.php')){
        include(
'templates/'.s('template').'/index.php');
    }
    else{
        
mysql_query("UPDATE ".db('prefix')."settings SET value = 'default' WHERE name = 'template'");
        include(
'templates/default/index.php');
    }
?>


Right. Now imagen you would like to have (in a local network) just the... lead_articles shown and from there a link to the index.php (so that the site works without having to rename every instance of index). This, lets call it LEADS.PHP would one be able to put up as an active desktop in order to have all the local clients view every post as soon as it is posted...

This isn't a problem at all when it comes to an ordinary install of sNews as I can call the LEADS.PHP to the active desktop like any other page, but in the MU version the snewsMU.php isn't included the ordinary way, right..

Any help here ? I would to be precise place the LEADS:PHP inside the template folder and be able to put just ONE function from snews in there... (function lead_articles(0,8);)

Thanks for any clues - P
Logged
"It's only dead fish that goes with the flow... "
Updated

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: User additional "startpage" besides index.php
« Reply #1 on: November 22, 2009, 05:53:02 PM »

Clarification: It looks to me like you are referring to Bakercad's First Template Switcher Mod (pre-Switcherizer 2 mod)... and the default sNews MU 1.6.3 package does not include that mod. If you have it in your current project, then you are (I assume) referring to the 1.6 MEMU project which does combine (among several other mods) Bakercad's MU and the first template switcher mod.

(Interpretation) # The site's template script...
If a file exists called index.php in a template folder that has the same name as the template chosen as the site-wide template (in the Settings > Template panel, stored in the settings table) ... in the templates directory... Include (use) it.
   ELSE
Update the settings table by setting the 'template' value as 'default'... and include the index.php file located in the default template folder.

Templates Rule  One:
With the current script in the root/index.php, it doesn't matter what the main template file in each template folder is called... so long as they all use the same file-name.
In its current configuration, we use index.php as the file-name for all of them because the default sNews template file is called index.php (eliminates confusion).
Example... let's say we named the template file in all template folders as mefirst.php... we'd simply change the file-name in the root/index.php file from index.php (in 3 locations) to mefirst.php ... and the templates would all function as they do now.

If you want the HOME page to show only the stuff generated by ONE function... function lead_articles(0,8) .... then make up a home template.
- The home template would be structured like any other template... a css file, an images folder (for template images) a thumbnail image of the template, and an index.php file.
- Within the <body> section of the index.php file, you decide what you want showing... just the function lead_articles(0,8) if that's your desire.

In your Settings > Template (admin) panel, choose the "Home" template as the site-wide template... and it will be the one that shows when viewers first land at the site. In this case, though, any page or articles you have have set to show on home won't since there would be no centre() function used.

Then, when you create any and all categories... you choose another template to show on everything in that category... and be sure to include all the functions you want in that template's index,php file. You could call one category "NEWS ARTICLES" and post all news articles to that category only.


Sorry... you cannot do this with the 1st generation of Bakercad's Template Switcher... you would need to updgrade it to his Switcherizer 2 mods.
« Last Edit: November 22, 2009, 06:10:40 PM by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: User additional "startpage" besides index.php
« Reply #2 on: November 22, 2009, 06:09:17 PM »

@ Patric.... I just realized you CANNOT choose templates by category with the Templates Switch mod in the MEMU package.
You would need to upgrade it to run with Bakercad's Switcherizer 2 package and his original download is still available as of this date from this post.
« Last Edit: November 22, 2009, 06:40:18 PM by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Re: User additional "startpage" besides index.php
« Reply #3 on: November 22, 2009, 06:37:51 PM »

Yupp, noticed that, hehe... Thanks anyhooo for the answer...
Logged
"It's only dead fish that goes with the flow... "
Updated

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Re: User additional "startpage" besides index.php
« Reply #4 on: November 22, 2009, 06:40:27 PM »

Hey, crazy Q.

What if I actually went on and named it index.php, and searched and replaced every instance if index in snews.php to index2, start or whatever. Would that work ?
Logged
"It's only dead fish that goes with the flow... "
Updated

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: User additional "startpage" besides index.php
« Reply #5 on: November 22, 2009, 06:42:17 PM »

Hey, crazy Q. ...... What if I actually went on and named it index.php, and searched and replaced every instance if index in snews.php to index2, start or whatever. Would that work ?

I don't know for sure. I would not do that... it could lead to other unwelcome problems.
The best solution would be to upgrade the MEMU package to use the Switherizer 2 package... then you would be able to have a HOME template set as site-wide template... and use one (or more) other template(s) for each other category that would have more functions, including the centre() function in its index.php file.

If you are not up to doing the upgrade, I could do it for you if you give me your current package as a zip.
« Last Edit: November 22, 2009, 06:47:02 PM by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Re: User additional "startpage" besides index.php
« Reply #6 on: November 23, 2009, 09:17:22 AM »

Mhm.. This way I could have the "lead" as HOME and everything else as another template... Sounds goodie.
Logged
"It's only dead fish that goes with the flow... "
Updated