vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   few questions about templates (https://vborg.vbsupport.ru/showthread.php?t=229973)

pawel.kudzia 12-11-2009 10:53 AM

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!

Lynne 12-11-2009 01:34 PM

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.

pawel.kudzia 12-11-2009 01:47 PM

hi Lynne

thanks a lot for your answers.
Quote:

Originally Posted by Lynne (Post 1928821)
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 (Post 1928821)
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!

Lynne 12-11-2009 02:16 PM

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

pawel.kudzia 12-11-2009 02:21 PM

thanks! i thought it's possible to include also additional files [ php/js ] in product-mod.xml

Lynne 12-11-2009 02:41 PM

No, you can't include actual files in the .xml file.

pawel.kudzia 12-11-2009 04:44 PM

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.


All times are GMT. The time now is 05:06 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.01017 seconds
  • Memory Usage 1,732KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete