Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-28-2001, 09:09 PM
chrispadfield's Avatar
chrispadfield chrispadfield is offline
 
Join Date: Oct 2001
Posts: 180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Where is the code that determines where the template will be used if a particular styleset does not have a template associated with it? I would like it so that the logic worked like this, i have 2 style sets.

If using style set A

if template - use it
if not template (ie not a custom one in styleset A) then use the default template that comes with VB.

If using style set B

if template use it
if no template, then use the template in style set A. If no template in styleset A then use default template.

See what i mean? This means that for template sets which only have a different header, footer and something else, i do not have to keep up to date every other single template from my default one.

any ideas?
Reply With Quote
  #2  
Old 05-28-2001, 09:16 PM
Mas*Mind's Avatar
Mas*Mind Mas*Mind is offline
 
Join Date: Oct 2001
Location: Amsterdam, The Netherlands, currently living in Cape Town, South Africa
Posts: 103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Correct me if I'm wrong, but do you mean you wanna implement multi-level inheritence?
Reply With Quote
  #3  
Old 05-28-2001, 09:20 PM
chrispadfield's Avatar
chrispadfield chrispadfield is offline
 
Join Date: Oct 2001
Posts: 180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes that is exactly what i want.
Reply With Quote
  #4  
Old 05-28-2001, 09:23 PM
Mas*Mind's Avatar
Mas*Mind Mas*Mind is offline
 
Join Date: Oct 2001
Location: Amsterdam, The Netherlands, currently living in Cape Town, South Africa
Posts: 103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Could be implemented, but probably will add alot of mysql-queries.

The problem is you can't predict which templates you have to select from the database on forehand. Mysql doesn't support recursive queries so you'd have to get a workaround on it which will add more queries.
Reply With Quote
  #5  
Old 05-28-2001, 09:27 PM
chrispadfield's Avatar
chrispadfield chrispadfield is offline
 
Join Date: Oct 2001
Posts: 180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

how does it do it now? if there is no template in a specific style? does it then go off and get the template from another style?

i thought an if elseif routine would just add 1 extra query per page which i can cope with but perhaps it is more than that. annoying.
Reply With Quote
  #6  
Old 05-28-2001, 09:31 PM
Mas*Mind's Avatar
Mas*Mind Mas*Mind is offline
 
Join Date: Oct 2001
Location: Amsterdam, The Netherlands, currently living in Cape Town, South Africa
Posts: 103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

right now 2 template-sets are selected on forehand: The default template set (with default I mean the one you can't edit, the one with id -1) and the users template-set.

If a template from the users-set doesn't exists he gets the one from the default set.
Reply With Quote
  #7  
Old 05-28-2001, 09:37 PM
chrispadfield's Avatar
chrispadfield chrispadfield is offline
 
Join Date: Oct 2001
Posts: 180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For my purpose the system would always be

Default -> A -> B/C/D/E/F

as A is my "default" set.

So i guess my options are:

i) using phpmyadmin (or i think there is a variable that allows you to override deleting the real default set, there was with the beta anyway) and over ride the actual default set with my set A templates. Problem is of course upgrading when template changes are made.

ii) somehow load 3 template sets instead of 2 and then change the bit that goes if x, use x elseif use x from template -1.

any idea where these bits of code are? i assume global.php - of to look.
Reply With Quote
  #8  
Old 05-28-2001, 09:43 PM
Mas*Mind's Avatar
Mas*Mind Mas*Mind is offline
 
Join Date: Oct 2001
Location: Amsterdam, The Netherlands, currently living in Cape Town, South Africa
Posts: 103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

With your solution you'll limit it to a certain level. The best solution would be to have no limit at all, so you can inherit many levels deep. I thought about it and I think it can be implemented without adding extra queries, but I haven't really figured out how.

The particular code is the cachetemplates function in admin/functions.php
Reply With Quote
  #9  
Old 05-28-2001, 09:47 PM
chrispadfield's Avatar
chrispadfield chrispadfield is offline
 
Join Date: Oct 2001
Posts: 180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i think this is the section:

PHP Code:
function cachetemplates($templateslist) {
  
// $templateslist: comma delimited list
  
global $templatecache,$DB_site,$templatesetid,$loadmaxusers,$loadbirthdays;

  
// add in sql info
  //$templateslist=str_replace(",","' OR title='",$templateslist);
  
$templateslist=str_replace(','"','"$templateslist);

  
// run query
  
$temps=$DB_site->query("SELECT template,title
                          FROM template
                          WHERE (title IN ('
$templateslist')
                            AND (templatesetid=-1 OR templatesetid='
$templatesetid'))
                          "
.iif ($loadmaxusers,"OR (title = 'maxloggedin')","")."
                          "
.iif ($loadbirthdays,"OR (title = 'birthdays')","")."
                          ORDER BY templatesetid"
);

  
// cache templates
  
while ($temp=$DB_site->fetch_array($temps)) {
    
$templatecache["$temp[title]"]=$temp['template'];
  }
  unset(
$temp);
  
$DB_site->free_result($temps);


how does this OR thing work

(templatesetid=-1 OR templatesetid='$templatesetid'))

does that mean, find a specific template where templatesetid=x as well as where templatesetid=-1? so both are returned. By ordering by templatesetid, the ones with a real template setid come up first?

any ideas what would happen if i just did

(templatesetid=-1 OR templatesetid='$templatesetid' OR tempatesetid='10'))

? if i ensure that all my other template sets have a higher number than 10? (or perhaps a lower number if that is what is needed)?
Reply With Quote
  #10  
Old 05-28-2001, 09:57 PM
Mas*Mind's Avatar
Mas*Mind Mas*Mind is offline
 
Join Date: Oct 2001
Location: Amsterdam, The Netherlands, currently living in Cape Town, South Africa
Posts: 103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That probably would work, only you have to change it to:

(templatesetid=-1 OR tempatesetid='10' OR templatesetid='$templatesetid'))

In that particular order, in order to let the inheritance happen in the right order (lot of orders)

but I'm not 100% sure. There is another disadvantage: The result of the query can be far more bigger now, resulting in a slight(?) slowdown...
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 07:14 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03993 seconds
  • Memory Usage 2,265KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete