View Single Post
  #423  
Old 03-24-2006, 08:54 PM
Barakat's Avatar
Barakat Barakat is offline
 
Join Date: Nov 2004
Location: Jerusalem
Posts: 571
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

loook i made this .... but need ur help .
hi !

i have a little problem in reading and viewing some html from my database which i make it .... acually iam trying to make some differnt hack which can read templates from the database instead to include it to the style templates

the idea comes to me when i was trying to add some html templates to the style and i saw that its from the stupidity to add a houndred templates to a styles so it will make the forum style very heavy for me . any way here is the idea ....

i create that

Code:
CREATE TABLE `testdb` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(50) NOT NULL default '',
  `descr` varchar(50) NOT NULL default '',
  `content` text NOT NULL,
  PRIMARY KEY  (`id`)
) TYPE=MyISAM;
and add for every id and content a unique number with a full html template.

i have more than 100 id with 100 full html text pages for that .
so i make a php file with a name of test.php and include that code inside it :

PHP Code:
<?php
/*======================================================================*\
|| #################################################################### ||
|| # test v6.0.1                                                                                                                  # ||
|| # Copyright ?2005- 2006 Barakat. All Rights Reserved.                                               # ||
|| #                                                                                                                                    # ||
|| #################################################################### ||
\*======================================================================*/

//-----------------------------------------
// By: Barakat Barakat

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

// ##################### DEFINE IMPORTANT CONSTANTS ####################### 
define('THIS_SCRIPT''test');  

// #################### 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(''); 

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

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

// #################### HARD CODE JAVASCRIPT PATHS ######################## 
$headinclude str_replace('clientscript'$vbulletin->options['bburl'] . '/clientscript'$headinclude); 

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

if ($id) {
function 
getcontent($contentid) {
$contents  =$vbulletin->db->query_read("SELECT content FROM " TABLE_PREFIX "testdb" "WHERE id=$contentid");
$content   $vbulletin->db->fetch_Array($contents);
$contentid =$content[content];
$html=str_replace("\"","\\\"",$contentid);
return 
$html;
}
$que =$vbulletin->db->query_read("SELECT * FROM " TABLE_PREFIX "testdb" "WHERE id=$id");
$result =$vbulletin->db->query_read($que)
  or die (
"Error reaching the file.... ");
$page $vbulletin->db->fetch_Array($result);
$navbits construct_navbits(array('' => $page[name]));
eval(
'$navbar .= "' fetch_template('navbar') . '";');
eval(
"print_output(\"".getcontent("$id")."\");");
}
/*======================================================================*\
|| ####################################################################
|| # CVS: $RCSfile: test.php,v $ - $Version: 6.0.1 $
|| ####################################################################
\*======================================================================*/
?>
www.forum/test.php?id=1
while browseing the file , a blank page appears to me !!!1

so ...........

if i include 'test_h' template to the style it will open it nicely but i need to read from my database by its id so to browse is as its browsed from the style it self:-

now if i want to read the templates from my styles i just make that changes

// pre-cache templates used by all actions

PHP Code:
$globaltemplates = array('test_h'); 
and add that code instead of the main script corner

PHP Code:
$navbits = array();  
$navbits[$parent] = 'testss'
$navbits construct_navbits($navbits); 
eval(
'$navbar = "' fetch_template('navbar') . '";'); 
eval(
'print_output("' fetch_template('test_h') . '");'); 

and off couse the test_h template is included and it tooks a style like that :-



Code:
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
	<!-- no cache headers -->
	<meta http-equiv="Pragma" content="no-cache" />
	<meta http-equiv="Expires" content="-1" />
	<meta http-equiv="Cache-Control" content="no-cache" />
	<!-- end no cache headers -->
	<title><phrase 1="$vboptions[bbtitle]">$vbphrase[x_powered_by_vbulletin]</phrase></title>
	$headinclude
</head>
<body>
$header
$navbar

<!-- html codes begins here-->
<!-- html codes ends here  -->

$footer
</body>
</html>
P.S i tried also to include the functions in a function_test file and upload it to the includes but it did not works .......
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01214 seconds
  • Memory Usage 1,830KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code
  • (3)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete