Yardım: Vbulletin Yeni Sayfa Oluşturma
4
●984
- 08-04-2014, 18:15:42Teşekkürler ama şablonda php kodu çalışmıyor sadece vbulletin değişkenleri çalışıyor iframe'de istemiyoruz.w3bmstr adlı üyeden alıntı: mesajı görüntüle
- 08-04-2014, 21:16:12vBulletin 4 Kullanıyorsan eğer şöyle birşey yapabilirsin:
Örnek Sayfa Kodları(Test sayfası için)
// ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('THIS_SCRIPT', 'test'); define('CSRF_PROTECTION', true); // 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('TEST', ); // pre-cache templates used by specific actions $actiontemplates = array(); // ######################### REQUIRE BACK-END ############################ // if your page is outside of your normal vb forums directory, you should change directories by uncommenting the next line // chdir ('/path/to/your/forums'); require_once('./global.php'); // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### $navbits = construct_navbits(array('' => 'Test Page')); $navbar = render_navbar_template($navbits); // ###### YOUR CUSTOM CODE GOES HERE ##### $pagetitle = 'My Page Title'; $degisken1 = 'Bla bla'; //Değişkenimizi oluşturalım $dizidegiskeni = array( 'key1' => 'value1', 'key2' => array(' 'key21' => 'value21', 'key22' => 'value22' ') ); // ###### NOW YOUR TEMPLATE IS BEING RENDERED ###### $templater = vB_Template::create('TEST'); $templater->register_page_templates(); $templater->register('navbar', $navbar); $templater->register('pagetitle', $pagetitle); $templater->register('degisken1', $degisken1);//Değişkenimizi kayıt edelim $templater->register('dizidegiskeni', $dizidegiskeni); // Dizi ifadeleri print_output($templater->render());Örnek şablon kodları (TEST şablonu için)
{vb:stylevar htmldoctype} <html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html"> <head> <title>{vb:raw vboptions.bbtitle} - {vb:raw pagetitle}</title> {vb:raw headinclude} {vb:raw headinclude_bottom} </head> <body> {vb:raw header} {vb:raw navbar} <div id="pagetitle"> <h1>{vb:raw pagetitle}</h1> </div> <h2 class="blockhead">Title</h2> <div class="blockbody"> <div class="blockrow"> {vb:raw degisken1} //Değikenimizi bu şekilde kullanabilirsin {vb:raw dizidegiskeni.key1} //Dizi Değişkeni {vb:raw dizidegiskeni.key2.key21} //Dizi Değişkeni </div> </div> {vb:raw footer} </body> </html>
--R10.NET; Flood Engellendi -->-> Yeni yazılan mesaj 21:16:12 -->-> Daha önceki mesaj 21:01:17 --
Şöylede yapabilirsiniz bunun dışında;
Diyelim bi php dosyanız var bunu include etmek istiyorsunuz;
// ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('THIS_SCRIPT', 'test'); define('CSRF_PROTECTION', true); // 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('TEST', ); // pre-cache templates used by specific actions $actiontemplates = array(); // ######################### REQUIRE BACK-END ############################ // if your page is outside of your normal vb forums directory, you should change directories by uncommenting the next line // chdir ('/path/to/your/forums'); require_once('./global.php'); // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### $navbits = construct_navbits(array('' => 'Test Page')); $navbar = render_navbar_template($navbits); // ###### YOUR CUSTOM CODE GOES HERE ##### $pagetitle = 'My Page Title'; //include edeceğimiz dosya ob_start(); include('path/to/dosya.php'); $includedphp = ob_get_contents(); ob_end_clean(); // ###### NOW YOUR TEMPLATE IS BEING RENDERED ###### $templater = vB_Template::create('TEST'); $templater->register_page_templates(); $templater->register('navbar', $navbar); $templater->register('pagetitle', $pagetitle); print_output($templater->render()); vB_Template::preRegister('TEST',array('includedphp ' => $includedphp));İyi çalışmalar - 08-04-2014, 22:38:51require_once('./global.php');
<?=$stylevar[htmldoctype]?>
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?=$stylevar[textdirection]?>" lang="<?=$stylevar[languagecode]?>">
<head>
<?=$headinclude?>
<title><?=$pagetitle?></title>
böyle bir çözüm ürettim. bana göre daha kullanışlı oldu