vBulletin Modifications

Methodology for plugin template changes

Welcome to vBHackers.com! - vBHackers Updates:

Go Back   vBulletin Modifications > General vBulletin Section > General vBulletin Support

Reply
 
LinkBack Thread Tools
Old 04-07-2006, 05:23 PM   #11
tgreer
Guest

Default

Ok, I've figured this out. Let's remind us all what we're trying to do here .

The idea is that if you have a plugin that requires a template modification - that's a bad idea. You don't want users trying to mod their templates, not following instructions, messing things up, then running to you for support.

Also, another plugin may come along and try to modify the same template... plus, what about patches that alter templates?

My idea is that you should create a brand new template entirely. Then, there should be a way to, on-the-fly, use YOUR template instead of the default template, IF your product is active/installed.

Here we go, folks! In my case, I want to use a custom template named invite_forumrules instead of forumrules.

Hook Location: cache_templates

You must first be a registered member to view any code.
This caches my template.

Hook Location: global_start

You must first be a registered member to view any code.
This will replace the cached forumrules with the cached invite_forumrules. Now, any code that fetches the forumrules template will in fact fetch YOUR template, but only if your plugin is active.

I still have a remaining question: how do you package a custom template in an xml install/product file?




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Old 04-07-2006, 05:40 PM   #12
vBulletin Guru
Arnoud's Avatar
Join Date: Nov 2004
Real Name: Arnoud Kuipers
Location: Europe, Flanders
Arnoud is on a distinguished road

Default

Ah, very nifty that... nice .

In reply to your adding templates question, you'll have to add this:
You must first be a registered member to view any code.
In between your install code tags and plugin tags in your installer of your Product (so basicly the .xml file).
If you want to add multiple templates you can do that like this:
You must first be a registered member to view any code.
If you'd like an example of a complete install script (with queries, phrases, etc), just ask and I'll type one up for you ;).

Btw, would you mind formulating that into a nice little howto with a link to this thread if you've got some spare time (the handling of custom templates)? It'd certainly be a nice addition to our how-to base .
__________________
Need some custom work done for your site, but can't find a (freelance) coder willing to take on the job? Good news: you needn't look further, as I'm currently accepting custom jobs! From a template fix to a completely new portal system, you name it and I'll make it exclusively for your site! Interested? Send me a PM for details. ;)


Please note that I will only provide support through the vBHackers.com Forums, not through MSN/email/PM.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 06:09 PM   #13
tgreer
Guest

Default

What does the "username" attribute in the template element need to be? Or, does it just inform the user in their admincp who authored the template?

Tell you what - want to test my first released "product"? If all works, I'll release it here, and write up a HOW-TO.
Attached Files
File Type: zip product-tgreer_invite.zip (1.8 KB, 2 views)

Last edited by tgreer; 04-07-2006 at 06:12 PM.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 06:15 PM   #14
vBulletin Guru
Arnoud's Avatar
Join Date: Nov 2004
Real Name: Arnoud Kuipers
Location: Europe, Flanders
Arnoud is on a distinguished road

Default

The username attribute is the name of the user who last edited the template, or in the case of an import: created the template.

I'll gladly test it out now, will post back with my findings .




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 06:29 PM   #15
tgreer
Guest

Default

I don't know about this... I worked hard to figure it out, but I see problems with replacing entire templates wholesale, on the fly. What about other hacks that might have made changes to the template?

So I think a method based on str_replace() might be better.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 06:32 PM   #16
vBulletin Guru
Arnoud's Avatar
Join Date: Nov 2004
Real Name: Arnoud Kuipers
Location: Europe, Flanders
Arnoud is on a distinguished road

Default

Alright, I've tested it on my local installation and the message is showing up fine.. there's one issue though: the box takes up about 3/4th of my page (horizontally), heh.

You can fix this by replacing:
You must first be a registered member to view any code.
with
You must first be a registered member to view any code.
I'd suggest either doing the above and removing the <p> tags, or doing the above but change the width, as it kinda messes up the design ;).

Unfortunately I currently don't have a public vB running so I can't test the search engine functions, but the rest works fine.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 06:35 PM   #17
Ken Iovino
Founder
Ken Iovino's Avatar
Join Date: Mar 2004
Real Name: Ken Iovino
Location: Miami, Florida
Ken Iovino is on a distinguished road

Default

You can edit templates via the plugin system. You could use this below. It will look for $navbar in the forumhome templates and add $myvar under it. Hope this helps alittle. ;) Hook forumhome_start. Now everytime that hook is called and the plugin is active, it will alter the template, but it won't acually update the template. So the user will never see $myvar in the templates. The only downfall is when users want to custimize it, makes it alot harder.
You must first be a registered member to view any code.
__________________
Earnersforum.com - Learn how to make money online! New Look!

Ken Iovino / vBHackers.com
vBSEO 3.2.0 Launched - Maximum Overdrive for Your Web Traffic! Over 100 Instant SEO Optimizations

vBSEO Google Sitemap Generator - Version 2.2 Released Mandatory Upgrade for vBSEO 3.2.0 GOLD

6X Traffic - $1400 in One Day with vBSEO! Imagine What the vBSEO Patent Pending Technology Can Do For You.

Crawlability Network: vBulletin SEO | vBulletin Hackers

Last edited by Ken Iovino; 04-07-2006 at 06:44 PM.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 06:35 PM   #18
vBulletin Guru
Arnoud's Avatar
Join Date: Nov 2004
Real Name: Arnoud Kuipers
Location: Europe, Flanders
Arnoud is on a distinguished road

Default

Yes, overwriting entire templates isn't the best option.

What about the automaticly adding the conditionals to the templates with the install script though? It would modify the template, but not replace it nor harm any currently installed mods.

Quote:
Originally Posted by LiveWire
You can edit templates via the plugin system. You could use this below. It will look for $navbar in the forumhome templates and add $myvar under it. Hope this helps alittle. ;)
You must first be a registered member to view any code.
Yeah that's what I ment. Didn't know you could use str_replace for that though .




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 06:44 PM   #19
Ken Iovino
Founder
Ken Iovino's Avatar
Join Date: Mar 2004
Real Name: Ken Iovino
Location: Miami, Florida
Ken Iovino is on a distinguished road

Default

I edited my above post to explain abit more
__________________
Earnersforum.com - Learn how to make money online! New Look!

Ken Iovino / vBHackers.com
vBSEO 3.2.0 Launched - Maximum Overdrive for Your Web Traffic! Over 100 Instant SEO Optimizations

vBSEO Google Sitemap Generator - Version 2.2 Released Mandatory Upgrade for vBSEO 3.2.0 GOLD

6X Traffic - $1400 in One Day with vBSEO! Imagine What the vBSEO Patent Pending Technology Can Do For You.

Crawlability Network: vBulletin SEO | vBulletin Hackers




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 06:48 PM   #20
tgreer
Guest

Default

We're on the right track. I'll work on this a bit more.

In my particular scenario, I need to "embed" forumrules within a new template that will be used instead of forumrules (hope that makes sense).




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Variables from .php to template Anubis General vBulletin Support 16 04-06-2006 07:17 PM
allowing 3 styles to share 1 template set?? figure004 General vBulletin Support 2 02-08-2006 04:33 PM
How Do You Delete A Template? Stunt General vBulletin Support 6 10-01-2005 02:38 PM
Index Template required Gary Bolton vBulletin Modification Requests 1 01-29-2005 08:45 AM


All times are GMT -3. The time now is 11:35 AM.


SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc. (Patent Pending)