kigogu Posted June 7, 2012 Share Posted June 7, 2012 This is a problem that I have been struggling with, I am working on something that will hold all the content for multiple pages in a website with only just one file. This file will just contain the content that will be displayed. The content will then be parsed to a template file that holds the style of the website, but I am having trouble displaying only certain parts of the content. I can load all of the content for all of the pages at once, but I do not know how to choose which content to display when I want it to be displayed. I have looked in to JQuery, but I do not know how to use it for what I am trying to do. Is there a way I could just pass in php values to a function that will just rewrite everything? An example of this would be something like (3 pages): one page I have a contact form that will have fields like first name and last name, so on. At the bottom is the submit button, once they click on that they move to the next page. the next page will have some information that will be displayed in text. At the bottom of this page is another submit button, once they click on that they move to the next page. the last page will just thank the user for spending their time on the website and there is no button at the bottom. The file that will contain all of the content will hold the values and fields that will be required to display each one of these pages. I am trying to place each one of the three contents one at a time. So the second page will not display until the user clicks the submit button from the first page, and the last page wont display until the user clicks the submit button on the second page. I have no idea how to do this lol The file that contains the content does not hold the actual html values, only the attribute values and the type that it should be. I run that through a php program that will turn that in to an html string that will then parse it to the template file. Hopefully I have provided at least some description as to what i'm trying to accomplish lol Quote Link to comment https://forums.phpfreaks.com/topic/263816-displaying-different-content/ Share on other sites More sharing options...
Drongo_III Posted June 7, 2012 Share Posted June 7, 2012 So if i understand this right you want to house all your pages in one html file and selectively display the content depending on what the user clicks? I wouldnt really recommend doing that but... You could do it with php by adding a query string to your links for each page - i.e. <a href="yourScript?page=1">Page One</a> Then you could have some php that would checks the query string and echos the content accordingly. Something like: <?php $page = $_GET['page']; if($page == 1){ echo "HTML CONTENT FOR PAGE ONE"; //or better still hold the content elsewhere and include it } ?> This would probably be preferable to using jquery because you'd have to hide the divs so they won't get spidered by search engines. Hope that helps a bit... Quote Link to comment https://forums.phpfreaks.com/topic/263816-displaying-different-content/#findComment-1351978 Share on other sites More sharing options...
kigogu Posted June 8, 2012 Author Share Posted June 8, 2012 Awesome ^^ I will definitely try this when I get a chance. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/263816-displaying-different-content/#findComment-1352273 Share on other sites More sharing options...
kigogu Posted June 12, 2012 Author Share Posted June 12, 2012 I ended up just going with JQuery and creating a function to change the content based on the button that was clicked ^^ Quote Link to comment https://forums.phpfreaks.com/topic/263816-displaying-different-content/#findComment-1353148 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.