Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 12-11-2009, 10:53 AM
pawel.kudzia pawel.kudzia is offline
 
Join Date: Nov 2009
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default few questions about templates

hello,

what is the best-practice for writing new templates for custom pages?

i've followed this tutorial and have no problem creating custom pages. but work with the built-in adminapc's template editor is not very handy, there is a lot of changing/saving/reloading/finding the right place in template again and again. can i - during design time - store template in a regular file?

also - where can i find tutorial how to bundle few custom templates, few custom .php files and some plugins as one product that can be easily exported / installed on other forum?

i'm using vbulletin 4beta5. thanks in advance for your help!
Reply With Quote
  #2  
Old 12-11-2009, 01:34 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I usually write my template out in a text editor first before copy/pasting it into the template form.

There aren't any tutorials on how to bundle them. Basically, when you create your mod in the admincp, always make sure you select the product when creating new templates, plugins, options, phrases, *whatever* and then they should all get exported when you export the product.
Reply With Quote
  #3  
Old 12-11-2009, 01:47 PM
pawel.kudzia pawel.kudzia is offline
 
Join Date: Nov 2009
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hi Lynne

thanks a lot for your answers.
Quote:
Originally Posted by Lynne View Post
I usually write my template out in a text editor first before copy/pasting it into the template form.
yeah - that's doable but still a lot of switching forth and back. but apparently it's not just me with that problem.

Quote:
Originally Posted by Lynne View Post
There aren't any tutorials on how to bundle them. Basically, when you create your mod in the admincp, always make sure you select the product when creating new templates, plugins, options, phrases, *whatever* and then they should all get exported when you export the product.
great.. i did not thought about that. can i bundle also custom files [ for instance stand-alone php scripts or js'es ] into a product?

thanks!
Reply With Quote
  #4  
Old 12-11-2009, 02:16 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You might want to download a mod that comes with files and see how they did it. Usually, you get a zip file when you download a mod. Open the zip file and you get something like this:

- install.txt - the install instructions
- product-mod.xml - the product
- upload - just a folder
-- newfile.php - a file to upload in the main forum
-- images - an image folder
--- misc - a misc folder in the image folder
---- newimage.jpg - an image to upload in the images/misc folder
---- newimage2.jpg - another image to upload in the images/misc folder
Reply With Quote
  #5  
Old 12-11-2009, 02:21 PM
pawel.kudzia pawel.kudzia is offline
 
Join Date: Nov 2009
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks! i thought it's possible to include also additional files [ php/js ] in product-mod.xml
Reply With Quote
  #6  
Old 12-11-2009, 02:41 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, you can't include actual files in the .xml file.
Reply With Quote
  #7  
Old 12-11-2009, 04:44 PM
pawel.kudzia pawel.kudzia is offline
 
Join Date: Nov 2009
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok. so i will answer myself, at least partially.

vision of using built-in editor upset me so i've looked into the code and figured out that [only for development time; not for production!] i can load templates from files. here is how:

#1 create sample page as described at https://vborg.vbsupport.ru/showthread.php?t=228112

#2 modify end of the php file
PHP Code:
$templater vB_Template::create('TEST');
$templater->register_page_templates();
$templater->register('navbar'$navbar);
$templater->register('pagetitle'$pagetitle);
// here come the changes:
require_once('includes/adminfunctions_template.php');
$vbulletin->templatecache[$templater->get_template_name()] = compile_template(file_get_contents './myTemplate.html' ));
// and last line remains unchanged
print_output($templater->render()); 
#3 add template as usual in adminCP, but store it's content also in ./myTemplate.html . if you need to do quick update - just modify that file.

this seems to work fine for me.. under vB4b5 at least.
Reply With Quote
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

Forum Jump


All times are GMT. The time now is 10: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.04094 seconds
  • Memory Usage 2,219KB
  • 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
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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