vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Declaring variables within a template (https://vborg.vbsupport.ru/showthread.php?t=170068)

The Cat! 02-09-2008 06:05 PM

Declaring variables within a template
 
I can't seem to declare a variable within a template.

If I wanted to say $name="Bob" in a template, how

would I go about it? Sorry all, I am a newbie at coding

but everybody has to start somewhere :)

Lynne 02-09-2008 06:08 PM

You cannot use php within a template. If you want to declare a variable to be used in a template, you need to add a plugin that uses a hook within that php page. The hook you use depends on where you want to use that variable. If you give us a bit more information on what you want to do, we may be able to make suggestions on which hook to use.

The Cat! 02-09-2008 06:19 PM

I am trying to build the famous "multiple sites with common forum",

and I am soooo close to success... What I am trying to do is change

the url of the last post within a certain forum (forum #35) in forumhome_lastpostby

Basically, I am trying to say - if $forumid = '35' then $urll = "site2.com"

else $urll = "site1.com" ($urll is the variable)

And I know nothing about plugin and hook... LOL

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

After investigating the plugin and hook system, I have

written the proper code to make this work. Thank you

Lynne for getting me going in the right direction.


All times are GMT. The time now is 08:15 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.00950 seconds
  • Memory Usage 1,708KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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