Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/263816-displaying-different-content/
Share on other sites

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...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.