Seperating code from content

From: Date: Mon, 07 Apr 2003 07:54:04 +0000
Subject: Seperating code from content
Groups: php.general 
Request: Send a blank email to php-general+get-142653@lists.php.net to get a copy of this message
Hi all, I want users to be able to upload a template of this file in a content management system but the pageid would have to be written somehow as the user uploads the file. IE at the moment I am writing in a physical number looking at a table (called content) which relates to the content I want displayed on the particular page. How would you go about allowing users to upload this file and somehow write the correct PageID into this code or would you do it some other way? The reason being I don't want to have variable URL strings. <?php $SECTION_NAME = "careers.php"; /////////////////functions here all included in output_fns.php//////////////////// //////////////////////////////////////////////////////////////////////// ////////// // include the files from output fns to get functions which design the page include ('output_fns.php'); // put the top of the page in position title goes in the brackets, maximise for search engine use. do_html_header("Viola Systems Ltd. Who we are and how we can help you embed the Internet."); // get page Title & body text from DB // connect & query db_connect(); // select the page from the database (PageID defining the content returned) // This is the problem How to automatically produce the right PageID if the page is uploaded? $query = "select * from content where PageID='5'"; $result = mysql_query($query) or die("Error: Query failure with<BR>$query<BR>".mysql_error()); while ($array = mysql_fetch_array($result)) { $PageID = "{$array["PageID"]}"; $PageTitle = "{$array["Title"]}"; $BodyText = "{$array["BodyText"]}"; $Picture1 = "{$array["PictureOne"]}"; $Picture2 = "{$array["PictureTwo"]}"; $Document = "{$array["document"]}"; $CatID = "{$array["CatID"]}"; } // carry variables into do_html_page() function in output_fns. do_html_page($PageID, $PageTitle, $BodyText, $Picture1, $Picture2, $CatID, $SECTION_NAME, $Document); // put the page footer in position do_html_footer(); ?> Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com stephen.jackson@violasystems.com Mobile +358 50 343 5159

« previous php.general (#142653) next »