I'm thinking of setting up a page that has 3 sections separated by dividers. I would like the visitor to be able to choose a section or sections on a page and only print sections they want.
Am I on the right track with PHP or is there a better way?
I'm new to this. Thanks in advance.
Can PHP be used to print a portion of a page?
Moderator: General Moderators
Yea, you should be able to do that. Are you wondering what functions to use? or how you would do it logically?
To output the data i'd probably use print or echo's heredoc syntax. Depending on how much data will be displayed per section you might also want to look into ways to buffer / compress the data.
To output the data i'd probably use print or echo's heredoc syntax. Depending on how much data will be displayed per section you might also want to look into ways to buffer / compress the data.
-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
Oh, and to actually address your question, here is how I would go about doing this.
First: Find out which sections the user wants to see.
Second: Find a way to store the section names / numbers in a variable. This will simplify the next step.
Third: Output the sections to browser. I'd probably do this by first using a switch statement to find out which sections the user has said he/she wants to see, then using echo's heredoc syntax (http://us2.php.net/echo) to actually put the data on the screen.
Feel free to ask many more questions.
Hope this helps?
First: Find out which sections the user wants to see.
Second: Find a way to store the section names / numbers in a variable. This will simplify the next step.
Third: Output the sections to browser. I'd probably do this by first using a switch statement to find out which sections the user has said he/she wants to see, then using echo's heredoc syntax (http://us2.php.net/echo) to actually put the data on the screen.
Feel free to ask many more questions.
Hope this helps?