Go Back   Pligg CMS Forum > Pligg Development > Pligg Templates > Template Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-20-2006, 11:00 AM
stephencarr's Avatar
Casual Pligger
 
Join Date: Jul 2006
Location: UK
Posts: 70
Thanks: 18
Thanked 1 Time in 1 Post
Send a message via MSN to stephencarr Send a message via Skype™ to stephencarr
Question How to use your own template file structure?

I am developing my own template and I want to reduce the number of files that are currently in Mollio or Skidoo. In doing this I am also naming .tpl files differently so that they make more sense to me. A simple example, in Mollio the footer is called footer.tpl and you simply include it like this:

{include file="$tpl_footer.tpl"}

However, if I want to change it to somethign like foot.tpl and include it like this:

{include file="$tpl_foot.tpl"}

It does not get included. I can't seem to find where or how template file names are defined, it seems that you can't just make up your own file names and include them. I am kind of worried that it might not be possible to be really creative with templates because you have to stick to the file names already defined. If anyone has any advise on this please let me know.

Last edited by stephencarr; 08-20-2006 at 11:19 AM..
Reply With Quote
  #2 (permalink)  
Old 08-20-2006, 11:46 AM
Div Div is offline
Casual Pligger
 
Join Date: May 2006
Posts: 60
Thanks: 0
Thanked 7 Times in 4 Posts
I'm not sure, but aren't they difined in the smartyvariables.php in the libs folder? I'm pretty sure thats where the file names are set.

Hope that helps.
__________________
DivGamer.com
Reply With Quote
  #3 (permalink)  
Old 08-20-2006, 01:14 PM
stephencarr's Avatar
Casual Pligger
 
Join Date: Jul 2006
Location: UK
Posts: 70
Thanks: 18
Thanked 1 Time in 1 Post
Send a message via MSN to stephencarr Send a message via Skype™ to stephencarr
Quote:
Originally Posted by Div View Post
I'm not sure, but aren't they difined in the smartyvariables.php in the libs folder? I'm pretty sure thats where the file names are set.

Hope that helps.
If that is true then this is bad for templaters. Since all the stuff in libs is core code the template methodology would mean you don't touch that. I want to be able to dump a template in my templates directory and it just work, I don't want to have to request a user to update his lib folder too. I thought smarty was smarter than having to pre-define includes.
Reply With Quote
  #4 (permalink)  
Old 08-20-2006, 01:28 PM
kbeeveer46's Avatar
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,547
Thanks: 254
Thanked 649 Times in 513 Posts
Once you have a template you want to use all you should have to do is upload it into your templates folder. After that you type this URL into your address bar:

http://www.yoursite.com/settemplate....e=templatename

Make sure to change "yoursite" to your site name and "templatename" to the name of the folder your new template is in.
__________________
I accept donations for my time helping users like you on the forum and IRC.
Reply With Quote
  #5 (permalink)  
Old 08-20-2006, 01:41 PM
stephencarr's Avatar
Casual Pligger
 
Join Date: Jul 2006
Location: UK
Posts: 70
Thanks: 18
Thanked 1 Time in 1 Post
Send a message via MSN to stephencarr Send a message via Skype™ to stephencarr
Quote:
Originally Posted by kbeeveer46 View Post
Once you have a template you want to use all you should have to do is upload it into your templates folder. After that you type this URL into your address bar:

http://www.yoursite.com/settemplate....e=templatename

Make sure to change "yoursite" to your site name and "templatename" to the name of the folder your new template is in.
I think you are misunderstanding what I am talking about. I know how to load up my template into Pligg, I am asking what happens if I want to change the file structure or use template files that are not defined in /lib/smartyvariables.php

The more I poke around the more I realise that the templating (display and logic abstraction) is pretty basic in Pligg. You have what you need to do the basics but beyond that you have to hack files that lay outside of the template directory. But having read some of the comments in the code it seems the main Pligg guys are working on this which is promising.
Reply With Quote
  #6 (permalink)  
Old 08-20-2006, 02:12 PM
Div Div is offline
Casual Pligger
 
Join Date: May 2006
Posts: 60
Thanks: 0
Thanked 7 Times in 4 Posts
Quote:
Originally Posted by stephencarr View Post
If that is true then this is bad for templaters. Since all the stuff in libs is core code the template methodology would mean you don't touch that. I want to be able to dump a template in my templates directory and it just work, I don't want to have to request a user to update his lib folder too. I thought smarty was smarter than having to pre-define includes.
I would guess then you would have to use the standard names for the tpl files to have a standard template that would work by just putting it in the templates folder. If your gonna change the names to other, non standard names, then I guess an update to the smartyvariables would be needed. Like I said, I'm not 100% sure if they are absolute, I just did a search in the code to find where the tpl files are specified, and it seems that the smartyvariables is where the names of the files are set. Maybe the smartyvariables file should be in the template folder itself, so that it comes with the new template (just a thought). Then the template maker would set the file names in the smartyvariables file to match the names they use. You could run into some problems though, because some people don't use the same common sense naming as others.
__________________
DivGamer.com
Reply With Quote
  #7 (permalink)  
Old 08-20-2006, 03:48 PM
savant's Avatar
Constant Pligger
 
Join Date: Apr 2006
Location: UK
Posts: 1,218
Thanks: 64
Thanked 207 Times in 148 Posts
try this

{include file="foot.tpl"}

just that no tpl stuff
Reply With Quote
The Following User Says Thank You to savant For This Useful Post:
  #8 (permalink)  
Old 08-20-2006, 07:11 PM
Constant Pligger
 
Join Date: Mar 2006
Posts: 575
Thanks: 14
Thanked 126 Times in 61 Posts
Maybe i haven't understood correctly one of the original questions, but you define which templates are used in the main files, for example:

In index.php, the final line is $main_smarty->display($the_template . '/index.tpl');

This is calling the index.tpl template file when index.php is used. So if you want to rename index.tpl to main.tpl for instance, you'd do so, and then change the corresponding line in index.php.
__________________


Last edited by Simon; 08-20-2006 at 07:14 PM..
Reply With Quote
  #9 (permalink)  
Old 08-21-2006, 04:39 AM
stephencarr's Avatar
Casual Pligger
 
Join Date: Jul 2006
Location: UK
Posts: 70
Thanks: 18
Thanked 1 Time in 1 Post
Send a message via MSN to stephencarr Send a message via Skype™ to stephencarr
The problem is index.php is a core file and not a template file. When building templates you should not really be touching any of the core logic stuff. Anything outside of /templates should be left alone otherwise when you ask someone to install your template on their system they will have to monkey around with files in the root and /lib. I was hoping to do everything I wanted to do only using .tpl, I thought smarty could do that. At the very least you would have thought you could do includes without having to define them elsewhere, that is just poor. I know I could always write the includes in php within the .tpl file but again, that seems like a hack.
Reply With Quote
  #10 (permalink)  
Old 08-21-2006, 03:35 PM
savant's Avatar
Constant Pligger
 
Join Date: Apr 2006
Location: UK
Posts: 1,218
Thanks: 64
Thanked 207 Times in 148 Posts
The basic tpl files in pligg sort of create a standardization in the use of templates
So as pligg develops further in the future, template designers can simply follow the standard method, and no tinkering around.

now if you wanted to use foot.tpl
you could simply open up body.tpl
and change

{include file="$tpl_footer.tpl"}

to

{include file="foot.tpl"}

and you could do this with the whole template. simply hardcode with the filenames you feel fit. and you do not have to define them anywhere else.
It should work alright.

Another way is to add some php code into the .tpl file. But i don't think you want something that does that.


hope this has helped

Last edited by savant; 08-21-2006 at 03:42 PM..
Reply With Quote
The Following User Says Thank You to savant For This Useful Post:
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
LemonTwist Template (Free) by Yankidank Yankidank Pligg Templates 29 11-20-2008 01:44 AM
MacBlue Free Pligg Template by Yankidank Yankidank Pligg Templates 13 11-10-2008 05:37 PM
Internal Server Error cvcxl Bug Report 2 02-29-2008 06:51 PM
Internal Server Error wagthis Bug Report 12 01-16-2007 05:20 PM
How to make / change a template in Pligg Beta 7 jimbeam General Help 0 12-05-2006 01:19 PM


Search Engine Friendly URLs by vBSEO 3.2.0