yakabod Posted October 6, 2007 Share Posted October 6, 2007 I installed this script. The script is called wFAQ 1.0. The file that is being called is a .php that contains the content of the script. How can I seperate the content and the PHP? I want to have the content on an .htm and have the php seperate. Since the content is "in" the php file, this is my results: http://caraudioclips.com/support.php <? include "faq_config.php"; // SHOW ADMIN HEADER echo $admin_info[header]; // IF USER HAS CLICKED ON A QUESTION if(isset($_GET['q_id'])) { $q_id = $_GET['q_id']; } if($q_id != "") { $question_query = mysql_query("SELECT * FROM faq_questions WHERE q_id='$q_id'"); $question = mysql_fetch_assoc($question_query); if(mysql_num_rows($question_query) == 0) { echo "<h2>An error has occurred:</h2> You are attempting to view an FAQ question that does not exist. "; } echo " <h2>$question[question]</h2> $question[answer] <form action='faq.php' method='POST'> <input type='submit' value='Back to FAQ'> </form> "; } else { // IF USER IS LOOKING AT THE MAIN PAGE $totalcount = 0; $faq_questions = mysql_query("SELECT * FROM faq_questions"); $faqcat = mysql_query("SELECT * FROM faq_categories ORDER BY c_order"); $num_of_kitties = mysql_num_rows($faqcat); while($faqcat_info = mysql_fetch_assoc($faqcat)) { $questions = mysql_query("SELECT q_id, c_id, question FROM faq_questions WHERE c_id='$faqcat_info[c_id]' ORDER BY q_order"); // SHOW CATEGORY NAME, IF IT CONTAINS QUESTIONS AND CATEGORY NAMES ARE TURNED ON if(mysql_num_rows($questions) > 0) { if($admin_info[showcats] == 1) { echo " <h2>$faqcat_info[category]</h2> "; } } // SHOW QUESTIONS $count = 0; while($question = mysql_fetch_assoc($questions)) { $totalcount++; $count++; // SHOW NUMBERS IF ENABLED if($admin_info[shownumbers] == 1) { if($admin_info[showcats] == 1) { echo "$count. "; } else { echo "$totalcount. "; } } echo "<a href='faq.php?q_id=$question[q_id]'>$question[question]</a><br>"; } // ADD SPACE AFTER THIS CATEGORY if(mysql_num_rows($questions) != 0 AND $admin_info[showcats] == 1) { echo "<br>"; } } } // SHOW HTML FOOTER echo $admin_info[footer]; ?> Thank you. Link to comment https://forums.phpfreaks.com/topic/72087-seperate-the-content-and-the-php/ Share on other sites More sharing options...
MadTechie Posted October 6, 2007 Share Posted October 6, 2007 one idea would be to setup a html file with some tags ie [counter] then read it in via file_get_contents then use str_replace to replace the tags with the values from the php script Link to comment https://forums.phpfreaks.com/topic/72087-seperate-the-content-and-the-php/#findComment-363288 Share on other sites More sharing options...
yakabod Posted October 6, 2007 Author Share Posted October 6, 2007 one idea would be to setup a html file with some tags ie [counter] then read it in via file_get_contents then use str_replace to replace the tags with the values from the php script :-\ I guess it's harder than I thought. Can anyone help me out here with the coding? Thanks Link to comment https://forums.phpfreaks.com/topic/72087-seperate-the-content-and-the-php/#findComment-363609 Share on other sites More sharing options...
RichardRotterdam Posted October 6, 2007 Share Posted October 6, 2007 I personally don't seperate the php from html code. That is i dont separate it entirely. I first create a html page with a layout then i deside what parts of that page should be dynamic and that's where i place the php to reduce. The php code even more on my layout page I use php classes. and the use of classes might be the way you want to go. seperating php code completely with file_get_contents and str_replace from html isn't really nessescarry unless your building a CMS which really requires it Link to comment https://forums.phpfreaks.com/topic/72087-seperate-the-content-and-the-php/#findComment-363625 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.