Jump to content

Theme


KYKK

Recommended Posts

Good god, man. I feel like I'm going around in circles.

what page.class ? your page.class that is very very very long? do i need all of those? or just part of it (then which part?)
Did you already forget how to include a file? require 'include/class.page.php'; That's all you need to do.Does the page output an error message that says the template file wasn't found? What code are you using?
Link to comment
Share on other sites

let me copy the stuff i edit didn't know you reply...EDIT______Template no found:in the template file wasn't found i think it is because i have$page->set_path('');and there no path and it go to space or something idk ... but it work if i put$page->set_path('templates'); I have the .tpl inside the templates folder AND same level as test.php ...________________CSS:then the CSS should work right?<link href="theme/{*theme}/{*theme}.css" rel="stylesheet" type="text/css" media="screen" />but it not .... i can echo the theme in the HTML BODY therewhen i say theme/{*theme}/{*theme}.cssis it saying the theme folder is the same level as the .tpl or the .php ?i try to put ../theme/{*theme}/{*theme}.css but it still not ...what i mean is i have my theme herehttp://kywebsite.co.cc/theme/blue/blue.cssand my .tplhttp://kywebsite.co.cc/templates/test.tpland my test.phphttp://kywebsite.co.cc/test.php?user=clanwebs________________________________________________________________________________Class.pageclass.page is not FOR your exsample right? it is for all tpl file working with php like class.page is the template system right?

Link to comment
Share on other sites

in the template file wasn't found i think it is because i have$page->set_path('');and there no path and it go to space or something idk ... but it work if i put$page->set_path('templates');
I don't think I ever tested it with an empty path, I'll have to check and see if there's a bug there somewhere.
when i say theme/{*theme}/{*theme}.cssis it saying the theme folder is the same level as the .tpl or the .php ?
Neither, all it does it replace the template tag with the data from PHP. If you write {*theme} in the tpl and have an item in the $content array called theme, then the template engine will replace the template tag with the value from PHP, that's all it does. It doesn't notice that you're trying to put the template tag inside a path and somehow validate that path, it just replaces the text. All paths in the document need to be relative to the PHP files though, maybe that was your question and I misunderstood. When you open the PHP page in a browser you see the HTML from the tpl files, but the URL in the browser is still pointing to the PHP file. So all paths are relative to where the PHP file is, like any other path. If your PHP files are in /php, such as /php/test.php, and your templates are anywhere else, if you have a link inside a template like this:<a href="file.php">it's going to look for /php/file.php, not where the tpls are at (the browser doesn't even know you're using a tpl). So the first one you posted will work:<link href="theme/{*theme}/{*theme}.css" rel="stylesheet" type="text/css" media="screen" />If you don't think it's working, open the PHP file in your browser and then go to View->Source and check what the template file put for those. It should have put the values that you saved on the PHP page. If it's not, check your PHP code.
class.page is not FOR your exsample right? it is for all tpl file working with php like class.page is the template system right?
Right, the class.page.php file defines a class called Page, and the Page class is what processes the templates.
Link to comment
Share on other sites

relative to the php file that what i mean...{*theme} it not working that why css link not working also......i put it in the .tpl file i have$content['theme'] = $row['theme'];and i can echo $row['theme']; it show in the test.phpand i did array$content = array( 'page_title' => 'theme',);and process it$page->process($content);then {*theme} should be = blue right? but it not showing anything when i put down just {*theme} in the body text...

Link to comment
Share on other sites

kywebsite.co.cc/test.php or kywebsite.co.cc/test.php?user=clanwebs if you want to see how it look...and it's code is(the include class and global is inside the include folder)

<?phprequire_once 'db.php';require_once 'include/class.page.php';require_once 'include/global.functions.php';$content = array(  'page_title' => 'theme',);$content['theme'] = $row['theme'];$content['content'] = $row['content'];$sql = "SELECT * FROM `users` WHERE `name` ='{$_GET['user']}'";$result = mysql_query($sql);while($row = mysql_fetch_array($result)){echo $row['theme'];echo $row['content'];}$page=new Page();$page->set_path('templates');$page->set_template('test.tpl');$page->process($content);$page->output();?>

and the tpl. is inside templates folder kywebsite.co.cc/templates/test.tpl

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>  <head>  <link href="theme/{*theme}/{*content}.css" rel="stylesheet" type="text/css" media="screen" />  <link href="theme/{*theme}/{*theme}.css" rel="stylesheet" type="text/css" media="screen" />    <title></title>  </head>  <body>	<a href="#">Theme is {*theme}.</body></html>

Link to comment
Share on other sites

what you mean? i suppose you saying getting it from database is select >? and setting value is the $content['theme'] = $row['theme']; array thing right?OK i it work now because i put the $content = array('page_title' => 'theme',);$content['theme'] = $row['theme'];$content['content'] = $row['content'];INSIDEwhile($row = mysql_fetch_array($result)){ echo $row['theme'];echo $row['content'];}so like thiswhile($row = mysql_fetch_array($result)){ echo $row['theme'];echo $row['content'];$content = array('page_title' => 'theme',);$content['theme'] = $row['theme'];$content['content'] = $row['content'];}then it work because it was ouside the $row result thingy.....now i need to fix my CSS for some reason it not working the way it suppose to be so problem solve thread close....

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...