vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Strings in templates? (https://vborg.vbsupport.ru/showthread.php?t=154632)

mrBjordal 08-08-2007 11:19 AM

Strings in templates?
 
Hi

I am trying to add my own vBulletin-powered pages, but I am new to php and vBulletin.

So far I have created a new file "job1.php" and added a new template at AdminCP. So far so good. Now I want to add more pages like "job2.php", "job3.php", on so on.

File "job1.php"
PHP Code:

<?php 

// ####################### SET PHP ENVIRONMENT ########################### 
error_reporting(E_ALL & ~E_NOTICE); 

// #################### DEFINE IMPORTANT CONSTANTS ####################### 
define('NO_REGISTER_GLOBALS'1); 
define('THIS_SCRIPT''job1'); // change this depending on your filename 

// ################### PRE-CACHE TEMPLATES AND DATA ###################### 
// get special phrase groups 
$phrasegroups = array( 

); 

// get special data templates from the datastore 
$specialtemplates = array( 
     
); 

// pre-cache templates used by all actions 
$globaltemplates = array( 
    
'job1'
); 

// pre-cache templates used by specific actions 
$actiontemplates = array( 

); 

// ######################### REQUIRE BACK-END ############################ 
require_once('./global.php'); 

// ####################################################################### 
// ######################## START MAIN SCRIPT ############################ 
// ####################################################################### 

$navbits = array(); 
$navbits[$parent] = 'Vacant Jobs'

$navbits construct_navbits($navbits); 
eval(
'$navbar = "' fetch_template('navbar') . '";'); 
eval(
'print_output("' fetch_template('JobTemplate') . '");'); 

?>


The template
HTML Code:

$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header

$navbar

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="tcat">Title</td>
</tr>
<tr>
        <td class="alt1">Text</td>
</tr>
</table>

$footer
</body>
</html>


How do I add variables in the php-file when using the same template for all files? All the php-files does have different titles. I am used to ".asp"-programming. Can I add strings like this and how is the php code for strings:

In the page "job1.php"
#1) in the <title> field: strTitle = "Reception/Office Assistant"
#2) in the <body> field: strEmployer = "Opera Software ASA"

In the page "job2.php"
#1) in the <title> field: strTitle = "Tender Coordinator"
#2) in the <body> field: strEmployer = "FMC Kongsberg Subsea AS"


My two questions:
Question #1) How do I code this in the php files?
Question #2) How do I code this in the template?


Anyone?
:o

Opserty 08-08-2007 11:43 AM

Variables are coded like this in php:

PHP Code:

$variable 'Your String'

In vBulletin it is possible to place variables in templates so you could write $strTitle in your template and then change it accordingly for each php file.

Is there a major difference between each of the jobX.php files?

You can create subpages within just a single job.php page, see this:
See the Creating Subpages section: https://vborg.vbsupport.ru/showthread.php?t=98009

Then you can access each section using the url http://anydomain.com/job.php?do=1 or something like that.

mrBjordal 08-08-2007 01:43 PM

Thank you very much :)


All times are GMT. The time now is 08:23 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.01762 seconds
  • Memory Usage 1,733KB
  • 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_html_printable
  • (2)bbcode_php_printable
  • (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