amwd07 Posted September 10, 2007 Share Posted September 10, 2007 Hello I wonder if someone can help me here I have created a website with custom CMS my problem is the default page index.php does not show any content however index.php?title=about pulls in the about us content I need to show a default if there is no query to pull in the welcome content I know I must be missing something simple I have tried creating a second query but it uses the same field to pull in the information and then the welcome appears on all pages // Get secondary data from the database $query="SELECT * FROM content WHERE title='$title'"; $result=mysql_query($query); mysql_close(); // Use all of the data obtained from various sources $content_id=mysql_result($result,$i,"content_id"); $desc=mysql_result($result,$i,"desc"); $main .= "$desc"; Quote Link to comment Share on other sites More sharing options...
micah1701 Posted September 10, 2007 Share Posted September 10, 2007 <?php if($title == ""){ $title = "welcome"; //or whatever the title is of your default page } // Get secondary data from the database ... ?> Quote Link to comment Share on other sites More sharing options...
amwd07 Posted September 10, 2007 Author Share Posted September 10, 2007 must have something wrong here I am using $main as the template varible I am sure you are on the right track if($title == ""){ $main .= "$desc"; //or whatever the title is of your default page } // Get initial data and assign variables first. $title = str_replace('-', ' ', $_GET['title']); // Get secondary data from the database $query="SELECT * FROM content WHERE title='$title'"; $result=mysql_query($query); mysql_close(); // Use all of the data obtained from various sources $content_id=mysql_result($result,$i,"content_id"); $desc=mysql_result($result,$i,"desc"); $title=mysql_result($result,$i,"title"); // also added this? $site_title = "Paris Cues"; $page_title = "$title"; $main .= "$desc"; Quote Link to comment Share on other sites More sharing options...
amwd07 Posted September 10, 2007 Author Share Posted September 10, 2007 your code seemed to of work when I move it below the query but i face the same problem as soon as I replace welcome with $desc nothing shows up? <?php // Get initial data and assign variables first. $title = str_replace('-', ' ', $_GET['title']); // Get secondary data from the database $query="SELECT * FROM content WHERE title='$title'"; $result=mysql_query($query); mysql_close(); // Use all of the data obtained from various sources $content_id=mysql_result($result,$i,"content_id"); $desc=mysql_result($result,$i,"desc"); $site_title = "Paris Cues"; $page_title = "$title"; if($title == ""){ $main .= "$desc"; //or whatever the title is of your default page } $main .= "$desc"; .... ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.