Page Index Toggle Pages: [1] 2  Send TopicPrint
Very Hot Topic (More than 25 Replies) [DONE] Set Template in URL 1.0 for YaBB 2.0/2.1 (Read 5695 times)
AK108
God Member
*****
Offline



Posts: 942
Joined: Oct 1st, 2003
Gender: Male
[DONE] Set Template in URL 1.0 for YaBB 2.0/2.1
Nov 2nd, 2005 at 12:01am
Print Post  
Current version: 1.0

It works 2.1 without a problem. Wink

This mod allows users and guests to set their template by editing the URL with the template=templatename URL argument. To set the template "fkpblue" at http://fkp.jkcsi.com/YaBB.pl, you'd use the URL http://fkp.jkcsi.com/YaBB.pl?template=fkpblue. Logged in users with a valid session have their template option in their profile changed. Guests have a cookie set, which can be deleted by setting the template to _default.

You can see this mod in action at http://fkp.jkcsi.com/YaBB.pl . My templates there are 'fkpblue' and 'conforums' (no quotes in the actual names Wink).

Version History:
1.0 (YaBB 2.0/2.1): 1.0 works just fine with YaBB 2.1. (No changes) (November 11, 2005)
1.0 (YaBB 2 Final): Mod package made available on BoardMod. (November 1, 2005)
« Last Edit: Apr 14th, 2007 at 6:57pm by AK108 »  

set_template_in_url_1.0.mod ( 2 KB | Downloads )

For my mods, check out my public notes.

You might be interested in my projects, or my forum, the Flying Kirby Pub.
Back to top
WWWAIM  
IP Logged
 
Xavier
Senior Member
****
Offline



Posts: 442
Location: Ipswich
Joined: Apr 5th, 2005
Gender: Male
Re: Set Template in URL 1.0 for YaBB 2 Final
Reply #1 - Nov 2nd, 2005 at 1:18am
Print Post  
Great Mod just one thing in the modlist you are missing some " on the second line and you ned to fix the ' to a " in the top line
  
Back to top
WWWYIM  
IP Logged
 
AK108
God Member
*****
Offline



Posts: 942
Joined: Oct 1st, 2003
Gender: Male
Re: Set Template in URL 1.0 for YaBB 2 Final
Reply #2 - Nov 2nd, 2005 at 2:47am
Print Post  
Nope, the single quotes and no quotes should work fine if you know when to use and not use them. I make an effort to use no quotes or single quotes when possible -- it makes my code more efficient.

Good catch though!
  

For my mods, check out my public notes.

You might be interested in my projects, or my forum, the Flying Kirby Pub.
Back to top
WWWAIM  
IP Logged
 
kiro
New Member
*
Offline


I N F E C T E D  L O G
I C

Posts: 20
Joined: Oct 5th, 2005
Re: Set Template in URL 1.0 for YaBB 2 Final
Reply #3 - Nov 2nd, 2005 at 1:18pm
Print Post  
How hard would it be to modify the board index so that people visiting one of the boards would see a specific template?
  
Back to top
WWW  
IP Logged
 
AK108
God Member
*****
Offline



Posts: 942
Joined: Oct 1st, 2003
Gender: Male
Re: Set Template in URL 1.0 for YaBB 2 Final
Reply #4 - Nov 2nd, 2005 at 1:43pm
Print Post  
That'd be a job for another mod, but it's doable. You would need to look into how to store information into a board data file, which is the hardest part. From there, just edit the WhatTemplate subroutine like I did here.
  

For my mods, check out my public notes.

You might be interested in my projects, or my forum, the Flying Kirby Pub.
Back to top
WWWAIM  
IP Logged
 
Bob_La_Londe
New Member
*
Offline


Fishing, Boating, Fishing,
Hunting, Fishing

Posts: 22
Location: Yuma
Joined: Oct 5th, 2004
Gender: Male
Re: Set Template in URL 1.0 for YaBB 2 Final
Reply #5 - Nov 2nd, 2005 at 2:52pm
Print Post  
Ok, I tried it, but it doesn't seem to work. 

I put itin my 2.0 mods directory. 
Ran board mod.
Selected the mod.
Uplaoded the two files documented in the mod.
created a test second template in the default templates directory.

Called it using
http://www.yumabassman.com/cgi-bin/yabb/YaBB.cgi

This loaded the default template just fine.

Then I tried it using:
http://www.yumabassman.com/cgi-bin/yabb/YaBB.cgi?template=siebler.html

and

http://www.yumabassman.com/cgi-bin/yabb/YaBB.cgi?template=siebler

Both of those just loaded it with the default template. 
  

***  FREE FISHING LURES DRAWING FOR MEMBERS
***  Public Fishing and Boating Forums
***  Fishing and Boating Link Index
Back to top
IP Logged
 
Bob_La_Londe
New Member
*
Offline


Fishing, Boating, Fishing,
Hunting, Fishing

Posts: 22
Location: Yuma
Joined: Oct 5th, 2004
Gender: Male
Re: Set Template in URL 1.0 for YaBB 2 Final
Reply #6 - Nov 2nd, 2005 at 3:11pm
Print Post  
The name of my test template is siebler.html

The only other mod I am running is the one to insert ythe image shack uploader module in the posts page.
  

***  FREE FISHING LURES DRAWING FOR MEMBERS
***  Public Fishing and Boating Forums
***  Fishing and Boating Link Index
Back to top
IP Logged
 
AK108
God Member
*****
Offline



Posts: 942
Joined: Oct 1st, 2003
Gender: Male
Re: Set Template in URL 1.0 for YaBB 2 Final
Reply #7 - Nov 2nd, 2005 at 11:16pm
Print Post  
It looks like one of your template's name is "new1". It works for me when using http://www.yumabassman.com/cgi-bin/yabb/YaBB.cgi?template=new1 . I temporarily registered an account to check these, and it worked both logged in and out.
  

For my mods, check out my public notes.

You might be interested in my projects, or my forum, the Flying Kirby Pub.
Back to top
WWWAIM  
IP Logged
 
Bob_La_Londe
New Member
*
Offline


Fishing, Boating, Fishing,
Hunting, Fishing

Posts: 22
Location: Yuma
Joined: Oct 5th, 2004
Gender: Male
Re: Set Template in URL 1.0 for YaBB 2 Final
Reply #8 - Nov 3rd, 2005 at 3:25am
Print Post  
Got it.  I have to create a whole file set in order to get a template to work.  Not just the .html file. 


  

***  FREE FISHING LURES DRAWING FOR MEMBERS
***  Public Fishing and Boating Forums
***  Fishing and Boating Link Index
Back to top
IP Logged
 
AK108
God Member
*****
Offline



Posts: 942
Joined: Oct 1st, 2003
Gender: Male
Re: Set Template in URL 1.0 for YaBB 2 Final
Reply #9 - Nov 3rd, 2005 at 4:21am
Print Post  
Yep, this just uses an existing Y2 template.
  

For my mods, check out my public notes.

You might be interested in my projects, or my forum, the Flying Kirby Pub.
Back to top
WWWAIM  
IP Logged
 
Bob_La_Londe
New Member
*
Offline


Fishing, Boating, Fishing,
Hunting, Fishing

Posts: 22
Location: Yuma
Joined: Oct 5th, 2004
Gender: Male
Re: Set Template in URL 1.0 for YaBB 2 Final
Reply #10 - Nov 4th, 2005 at 1:00am
Print Post  
I got it working now, and I'm learning the file structure and how to manipulate it.
  

***  FREE FISHING LURES DRAWING FOR MEMBERS
***  Public Fishing and Boating Forums
***  Fishing and Boating Link Index
Back to top
IP Logged
 
AK108
God Member
*****
Offline



Posts: 942
Joined: Oct 1st, 2003
Gender: Male
Re: Set Template in URL 1.0 for YaBB 2 Final
Reply #11 - Nov 4th, 2005 at 1:13am
Print Post  
Glad to hear it. Grin
  

For my mods, check out my public notes.

You might be interested in my projects, or my forum, the Flying Kirby Pub.
Back to top
WWWAIM  
IP Logged
 
Bob_La_Londe
New Member
*
Offline


Fishing, Boating, Fishing,
Hunting, Fishing

Posts: 22
Location: Yuma
Joined: Oct 5th, 2004
Gender: Male
Re: Set Template in URL 1.0 for YaBB 2 Final
Reply #12 - Nov 4th, 2005 at 9:07pm
Print Post  
I've been running this for over a day witth no hickups that I see.  I can see where some users of this mod may want to request some tweeks, and a documentation file explaining the process and how it does the job might be in order. 

Over all it looks like a relatively bug free first release. 

Some options that might be nice would be to have the option to have the default template always load unless the url is called with the template variable.  Selectable use by forum administrator.  I like it just the way it is, but others might want to do it differently.  Basically on or off selection by admin. 

Use default template if variable not passed YES / NO

An option to lock the template setting so the user can not change it in their profile.  It can only be changed by the forum administrator or by calling the url with the variable.  Of course this would proably need to be a selectable on/off feature. 

Allow user to manually select template in profile YES / NO 

Like I said, for my intended use it works perfectly.  For me no changes or additional features are needed.  Its a clean simple hack that does the job.
  

***  FREE FISHING LURES DRAWING FOR MEMBERS
***  Public Fishing and Boating Forums
***  Fishing and Boating Link Index
Back to top
IP Logged
 
AK108
God Member
*****
Offline



Posts: 942
Joined: Oct 1st, 2003
Gender: Male
Re: Set Template in URL 1.0 for YaBB 2 Final
Reply #13 - Nov 4th, 2005 at 11:32pm
Print Post  
Bob_La_Londe wrote on Nov 4th, 2005 at 9:07pm:
I've been running this for over a day witth no hickups that I see.  I can see where some users of this mod may want to request some tweeks, and a documentation file explaining the process and how it does the job might be in order.

Over all it looks like a relatively bug free first release.


Glad to hear it.

Quote:
Some options that might be nice would be to have the option to have the default template always load unless the url is called with the template variable.  Selectable use by forum administrator.  I like it just the way it is, but others might want to do it differently.  Basically on or off selection by admin.

Use default template if variable not passed YES / NO


The problem with this is that the template variable won't stay in the URL, so a guest would have to re-enter it in the URL to keep using the same template. That's the reason I used a cookie instead of using the URL completely. Unless your idea is to make it so Guests cannot keep the template set, I see no reason for this.

Quote:
An option to lock the template setting so the user can not change it in their profile.  It can only be changed by the forum administrator or by calling the url with the variable.  Of course this would proably need to be a selectable on/off feature. 

Allow user to manually select template in profile YES / NO


This sounds like a job for a more general purpose profile-locking system that would allow the admin to control what to allow users to set.

Quote:
Like I said, for my intended use it works perfectly.  For me no changes or additional features are needed.  Its a clean simple hack that does the job.


You might like to hear that I am working on adding a new feature that I think is useful all around: a template selector. I haven't decided how I'm going to implement it, but this would allow users and guests to quickly switch templates on the board index even if they don't know the template name. This might be implemented by way of <yabb> template tag, or another method.
  

For my mods, check out my public notes.

You might be interested in my projects, or my forum, the Flying Kirby Pub.
Back to top
WWWAIM  
IP Logged
 
kiro
New Member
*
Offline


I N F E C T E D  L O G
I C

Posts: 20
Joined: Oct 5th, 2005
Re: Set Template in URL 1.0 for YaBB 2 Final
Reply #14 - Nov 6th, 2005 at 9:11am
Print Post  
AK108 wrote on Nov 4th, 2005 at 11:32pm:
You might like to hear that I am working on adding a new feature that I think is useful all around: a template selector. I haven't decided how I'm going to implement it, but this would allow users and guests to quickly switch templates on the board index even if they don't know the template name. This might be implemented by way of <yabb> template tag, or another method.

How hard would it be to make the admin able to select the template used for each forum?  Seriously, someone please do this.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint