Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-31-2011, 07:53 PM
Artashes Artashes is offline
 
Join Date: Sep 2005
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Inserting a template via SQL Query

Hello

I am trying to insert new templates via SQL from an external application with the vb database as its database.

The template itself is being inserted correctly into the database. I have made it so that if the template name i supply my script with matches a template name in the database it copies the code (template and template_un), otherwise the template is blank.

This is all acting as I want it.

However, when I make modifications to a template which has the same name as a vb default, it does not result in any of the changes being made to the theme. In fact, when I go to the style manager in the admincp, it does not seem to realise that there is a customised version of the template (it is not red). When I make modifications to the one in the style manager it says that there is already a template and any modifications will override it.

Am I missing something here? How do I get vB to realise that there is a customised version of a default template?

Thanks,
Reply With Quote
  #2  
Old 08-31-2011, 08:18 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Looking at admincp/template.php in the "if ($_POST['do'] == 'updatetemplate')" section (around line 2236), it looks like if you are changing .css templates you need to call build_style() after (in includes/adminfunctions_template.php). Also if you change a template starting with 'bbcode_' you need to truncate the 'postparsed' table (but I'm guessing that's not part of the problem you're having).
Reply With Quote
  #3  
Old 08-31-2011, 08:39 PM
Artashes Artashes is offline
 
Join Date: Sep 2005
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Aye. That's where I've been looking. The templates are neither bbcode nor css, so it doesn't apply

I do everything that template.php does, I think!

This is the data I'm entering:

PHP Code:
            $data = array(
                
'templateid'   => ''
                
'styleid'      => $tStyleId,
                
'title'        => $name,
                
'template'     => $tTemplate,
                
'template_un'  => $tTemplateUn,
                
'templatetype' => 'template',
                
'dateline'     => $tTime,
                
'username'     => 'Artashes',
                
'version'      => '4.1.5',
                
'product'      => 'vbulletin',
                
'mergestatus'  => 'none' 
            
);

            if(
$this->db->insert('template'$data)){
                return 
TRUE;            
            } else {
                return 
FALSE;
            } 
The app uses CodeIgniter's database driver.

But I don't think this is the problem: everything is entered fine. I'll try entering a row into the adminlog.
Reply With Quote
  #4  
Old 08-31-2011, 08:51 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was looking at the wrong section. When you're modifying a template for a style that was inheriting that template, $_POST['do'] is set to 'inserttemplate'. In that section of the code it always calls print_build_style().

Edit: Specifically, it looks like the style table has a list of template ids for all templates in that style. Looks like a serialized array of arrays, so maybe if you don't want to call build_style you could try just updating that field.
Reply With Quote
  #5  
Old 08-31-2011, 09:03 PM
Artashes Artashes is offline
 
Join Date: Sep 2005
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You know what? I just discovered that myself! Coincidence much!? Just trying to get it to work now!

--------------- Added [DATE]1314837575[/DATE] at [TIME]1314837575[/TIME] ---------------

Neither worked for me
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 01:58 PM.


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.03573 seconds
  • Memory Usage 2,206KB
  • Queries Executed 11 (?)
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
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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_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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete