The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
rawphrase in custom php file
Hi
I created php page in vb 4.2.1 in my php code I used html codes too and I need add vb:rawphrase in it.but it doesn't work. what should I do? this is example code: HTML Code:
<table> <thead><tr><th colspan="2">{vb:rawphrase question_text}</th><th>{vb:rawphrase choices}</th><th>{vb:rawphrase score}</th></tr></thead> <tfoot><tr><td colspan="4"><div id="paging"><input type="submit" value="{vb:rawphrase submit_question}"></div></td></tr></tfoot> |
#2
|
|||
|
|||
What does the PHP code in your custom PHP file look like?
Also you're entirely sure those phrases exist? |
#3
|
|||
|
|||
Quote:
what do you mean of look like? I created a php page. for example "quiz". then I add template named "quiz". then in plugins I add some code to include another php file to quiz.php I need add vb:rawphrase and vb:stylevar in second php file yes I'm sure. |
#4
|
||||
|
||||
Quote:
Inside a template you use {vb:rawphrase question_text} etc. About the phrases, be sure you have set inside the php file, the correct Phrase Groups: PHP Code:
You set a group for each phrase you add on the system. |
#5
|
|||
|
|||
thank you so much dear Scandal
this code work for me without define phrasegroups: PHP Code:
because I have phrases with variable and I can't add variable with php code would you please tell me more about phrasegroups and its array contents? |
#6
|
||||
|
||||
hmmm, did you use the templater of vbulletin to display the content?
An example of use it is in this article. In the above article, there is the example template "TEST". Inside "TEST" you can use {vb:rawphrase something} instead of $vbphrase with php's echo's. Of course, phrase "something" in {vb:rawphrase something} should belongs to a phrase group which you have setup in $phrasegroups = array(...) at the start of your php file. To build the $phrasegroups array, you just need the phrase group varname (which you can find in admincp > (sidebar) Languages & Phrases > Phrase Manager > (button) Add New Phrase > (see the source code of Phrase Type select menu). For help reasons, I attach you here the phrase group varnames: Quote:
In the above page you add also your phrases. So, if you add the following code in your php file: $phrasegroups = array('wol', 'socialgroups'); .. when your php file loads, will load also all phrases that belongs to the above groups and you can use them in your template/php code as {vb:rawphrase or $vbphrase. |
Благодарность от: | ||
aminp30 |
#7
|
|||
|
|||
thank you Scandal for reply
yes I did. as you said, I add phrase group in my php file but it dosn't work yet. please take a look at my code: Code:
<?php error_reporting(E_ALL & ~E_NOTICE); define('THIS_SCRIPT', 'questions'); define('CSRF_PROTECTION', true); $phrasegroups = array('global'); $specialtemplates = array(); $globaltemplates = array('questions'); $actiontemplates = array(); require_once('./global.php'); require_once('./includes/functions.php'); // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### $allow= array(5,6,20,27); if(in_array($vbulletin->userinfo[usergroupid], $allow) == 0){ print_no_permission(); } $navbits = construct_navbits(array('' => $vbphrase['questions'])); $navbar = render_navbar_template($navbits); $pagetitle = 'Questions'; $templater = vB_Template::create('questions'); $templater->register_page_templates(); $templater->register('navbar', $navbar); $templater->register('pagetitle', 'questions'); print_output($templater->render()); ?> HTML Code:
<form action="" method="get"><div class="datagrid"><table> <thead><tr><th>{vb:rawphrase quiz_question_text}</th><th>{vb:rawphrase quiz_choices}</th><th>{vb:rawphrase quiz_score}</th></tr></thead> <tfoot><tr><td colspan="4"><div id="paging"><input type="submit" value="{vb:rawphrase quiz_submit_question}"></div></td></tr></tfoot> <tbody><tr> is there any thing wrong? |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|