Please login or register.

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

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

Joost

  • Guest
Re: [MOD] Different templates wherever you want
« Reply #30 on: October 29, 2007, 06:32:43 pm »

Yes. :)
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: [MOD] Different templates wherever you want
« Reply #31 on: October 29, 2007, 09:33:16 pm »

ok Joost, now you just need a new field in both categories and articles (or a new table that will tie cat/art to template), a dedicated 'template directory', and a means/option to assign a template to article/category in the admin.

Then alter your new index.php to respond to the assignments as opposed to hard coding, and everything can be done via admin, and can be changed without editing index.php.

A very possible, and powerful, extension to this mod.
Logged
Of all the things I have lost, it is my mind that I miss the most.

Joost

  • Guest
Re: [MOD] Different templates wherever you want
« Reply #32 on: October 30, 2007, 07:59:13 am »

Well, this mod started with the question 'how can I display a different title on the frontpage?'. Taken into account there is no need to hack the core, since 'REQUEST_URI' is used , this is as far as we can take this mod, in my opinion. It is basically a quick/smart solution for developers.
I agree that template setting from within admin, would be a powerful feature. But I doubt if the use of 'REQUEST_URI' would be very useful, since a relation between article and template is already created in the database. So were actually talking about a new mod.
At the moment I don't have time for that kind of project. Not for the next month or so. I am in the middle of a project, using CMSMadeSimple:-[ By the way, it can set templates in the administration panel.

Logged

Aysseline

  • Jr. Member
  • **
  • Karma: 4
  • Posts: 66
Re: [MOD] Different templates wherever you want
« Reply #33 on: November 13, 2007, 10:26:15 pm »

Hello Joost,
I want to know what is the difference between your MOD and this other:
http://snewscms.com/forum/index.php?topic=5323.0

My needs:
I want to be able to have different layouts (color or positions) for all pages of my sites,
I want a MOD compatible with multilanguage site (e.g. with MOD of Rui Mendes) and other MODs,
I want a minimal change on the sNews core and an easy implementation  ;D
Logged
sNews 1.6_patched - localhost, Xampp 1.6.2 - XPSP2

Joost

  • Guest
Re: [MOD] Different templates wherever you want
« Reply #34 on: November 13, 2007, 11:59:16 pm »

This mod doesn't do anything to the core and neither does Codetwist's mod  (I guess).
Differences? I don't know. Don't tell anyone, but I looked into his code several times but I am not smart enough to use it. :-[
Logged

Aysseline

  • Jr. Member
  • **
  • Karma: 4
  • Posts: 66
Re: [MOD] Different templates wherever you want
« Reply #35 on: November 14, 2007, 12:38:39 am »

Quote
but I looked into his code several times but I am not smart enough to use it.
I read all his post and it seems more complicated than yours to install :(
I make a try with your MOD, thanks.
Logged
sNews 1.6_patched - localhost, Xampp 1.6.2 - XPSP2

Phil

  • Full Member
  • ***
  • Karma: 1
  • Posts: 135
    • http://www.ckt.com
Re: [MOD] Different templates wherever you want
« Reply #36 on: November 18, 2007, 02:26:27 am »

Has anyone had success getting this to work with the multi-user version?
Logged

Joost

  • Guest
Re: [MOD] Different templates wherever you want
« Reply #37 on: November 18, 2007, 02:47:44 am »

There is no reason why it shouldn't work, Phil. It doesn't hack into the core, snews.php. So it basically version independent. :)
Logged

Phil

  • Full Member
  • ***
  • Karma: 1
  • Posts: 135
    • http://www.ckt.com
Re: [MOD] Different templates wherever you want
« Reply #38 on: November 18, 2007, 03:32:42 am »

There is no reason why it shouldn't work, Phil. It doesn't hack into the core, snews.php. So it basically version independent. :)

Ok, i didn't make a new index.php file as you indicated.  It wasn't until I saw another post here that I realized my error.

Thanks for this great mod!
« Last Edit: November 18, 2007, 03:58:31 am by Phil »
Logged

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
Re: [MOD] Different templates wherever you want (version independent)
« Reply #39 on: November 20, 2007, 10:09:18 am »

Hi Joost bear.
I'm tryin to make it work with my special sNews installation.
The goal is to have a separate template for the administration side (in fact the default package index and css file).

Is it be possible?

I made a new index using your code, renamed the old one, and renamed too the default package index into admin.php.

But I have errors in one of the snews file (I have 2 snews files since I use the Splitted articles Mod) when calling the new index file.
As it's working when not using your Mod I suppose something is missing somewhere.
This is how my Modded index file looks:
Code: [Select]
<?php session_start(); include('snews.php');
include(
'snews-split.php');
ob_start("ob_gzhandler");
if (
get_id('category')){$_SESSION[db('website').'redacteur_btob'] = 'true';}
if (
is_null($_SESSION[db('website').'redacteur_btob'])){
include(
'redacteur_btob.php');
$_SESSION[db('website').'redacteur_btob'] = 'true';
}elseif(
$_SESSION[db('website').'redacteur_btob'] == 'true'){
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('/administration/'$uri)): 
include ('admin.php');break;

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

// Default template for everything else (always last):
default:
include ('OLDindex.php');
endswitch;
}
templates ();
 }  
?>
Do you see someting wrong in it?
Did I miss something?

Joost

  • Guest
Re: [MOD] Different templates wherever you want (version independent)
« Reply #40 on: November 20, 2007, 04:26:55 pm »

Inspector Philippe,

To find out what's wrong, I need to know what error message is thrown. And is it shown on every page/template, or just in admin?

I noticed that you set a page for /administration/ . This means that 'admin.php' is only set for the page administration, not for /page_new/ , /settings/ and other pages, belonging to administration (administration as a whole, does not have a category name). If needed, I could make something up for the backend, but first we will have to solve the error problem.
Logged

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
Re: [MOD] Different templates wherever you want (version independent)
« Reply #41 on: November 20, 2007, 05:31:15 pm »

Hi Mr Joost the bear,
and thanks a lot your answer.

Error appears in function center() (which is Modded) at this line:
Code: [Select]
case isset($_GET['search']): search_keywords($_GET['search']); return; break;

Joost

  • Guest
Re: [MOD] Different templates wherever you want (version independent)
« Reply #42 on: November 20, 2007, 05:42:34 pm »

Hi Mr Joost the bear,
and thanks a lot your answer.

Error appears in function center() (which is Modded) at this line:
Code: [Select]
case isset($_GET['search']): search_keywords($_GET['search']); return; break;

I assume this code is in snews.php (not in the template). What is the error message saying?
And is it a mod I can find on the forum?
Logged

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
Re: [MOD] Different templates wherever you want (version independent)
« Reply #43 on: November 20, 2007, 05:54:17 pm »

I forgot the error message.  ;D
Quote
Parse error: syntax error, unexpected T_CASE in D:\XAMP\htdocs\hiseosnews\snews.php on line 715
And it's the very briliant Displaying Keywords and Keyword Cloud Mod which is used. :D

Joost

  • Guest
Re: [MOD] Different templates wherever you want (version independent)
« Reply #44 on: November 20, 2007, 06:29:55 pm »

Inspecteur,

Did you insert

Code: [Select]
<h3>Top Keywords</h3>
<div id="tagsbox">
<?php keyword_cloud(); ?>
</div>

in your templates?
Logged
Pages: 1 2 [3] 4 5 ... 9