Jump to content

templates system + .htaccess


KYKK

Recommended Posts

$content = array('page_title' => 'theme',);That sets the page title, but that comma at the end shouldn't be there.mysql_query("INSERT content SET h1title='{$h1title}'WHERE name='{$_SESSION[user_name]}'")It looks like you're trying to mix an INSERT and UPDATE statement. Insert statements do not have SET or WHERE clauses. Check the syntax for an INSERT statement.

Link to comment
Share on other sites

oops lol... what a big mistake....and now something go wrong with user.php

<?phprequire_once 'db.php';require_once 'include/class.page.php';require_once 'include/global.functions.php';$sql = "SELECT * FROM `users` WHERE `name` ='{$_GET['user']}'";$result = mysql_query($sql);while($row = mysql_fetch_array($result)){$content = array('page_title' => 'theme');$content['id'] = $row['id'];$content['name'] = $row['name'];$content['email'] = $row['email'];$content['theme'] = $row['theme'];$content['themecontent'] = $row['themecontent'];}$sql = "SELECT * FROM `content` WHERE `name` ='{$_GET['user']}'";$result2 = mysql_query($sql);while($row = mysql_fetch_array($result2)){$content = array('page_title' => 'theme');$content['h1title'] = $row['h1title'];$content['h2title'] = $row['h2title'];$content['h3title'] = $row['h3title'];$content['entry'] = $row['entry'];$content['byline'] = $row['byline'];$content['blockquote'] = $row['blockquote'];$content['post'] = $row['post'];}$page=new Page();$page->set_path('templates');$page->set_template('home.tpl');$page->process($content);$page->output();?>

and it showing the 2nd "group" of content= ... the h1title h2title and h3title ti showing those data but not the first one which are the theme partbecause they are from 2 table so i put them into 2 groupsfirst one is $sql = "SELECT * FROM `users` WHERE `name` ='{$_GET['user']}'";second one is$sql = "SELECT * FROM `content` WHERE `name` ='{$_GET['user']}'";and it only showing 2nd one... how i change the code so it showing both ?

Link to comment
Share on other sites

You have this line inside each loop:$content = array('page_title' => 'theme');Every time you run that line it resets the $content variable to a new array, so every time through the loop you're erasing everything that was already saved and making a new $content array. Remove that line from both loops, only have it once on the top of the page to start $content. It looks like you will need to create a new array for the box inside the loop and then assign it to content at the end of each loop. What does your TPL file look like?

Link to comment
Share on other sites

  • 3 weeks later...

it took me so long to find where i left off before the forums down....yea and it work so now i have different title + content box nowMy Title 1. hello 2. hi 3. byesomething like that... and i create a table for this kind of table name ol (CSS div class)and have field name title content but I have 3 content (maybe more depend on what users want)should I have 3 row for the array ? likename title content----------------------------------clanwebs HI helloclanwebs HI hiclanwebs Hi byeand in the array what i putyou said

$result = mysql_query("SELECT title, content FROM custom_fields WHERE user='user1'");$boxes = array();while ($row = mysql_fetch_assoc($result)){  $new_box = array('title' => $row['title'], 'content' => $row['content']);  $boxes[] = $new_box;}$content['boxes'] = $boxes;

for each box that have 1 title and 1 content and what i put for 1 title and muti content?I thinking something like echo all Hi title and it content same as how you echo the boxes for each user???

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...