Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Jan 2008
    Posts
    103
    Plugin Contributions
    0

    Default Embed php template within another php template based on drop-down menu selection?

    Hi everyone,

    I'm having some trouble accomplishing what I thought would be a relatively simple task.

    I have a section of the site that will have several articles/posts. I'd like to create one page for the articles rather than 10-20 separate pages, with separate defines, templates, etc. To do this, I would have to embed the article within this one page, and it would have to automatically update based on a dropdown menu selection made by the user.

    I was thinking this could be done with php--I can create a separate php file for each article (with the article text) and store it in one folder on the server (just like how zen cart pulls the header and footer information, etc.).

    I know how to create a dropdown and how to embed php, but to make them work together is a struggle, let alone to make the page update automatically.

    Can anyone help, please?

  2. #2
    Join Date
    Nov 2006
    Location
    Dartmouth, NS Canada
    Posts
    2,378
    Plugin Contributions
    0

    Default Re: Embed php template within another php template based on drop-down menu selection?

    Why not use ZC's built-in EZpages and the EZpage menu? No need to reinvent the wheel.

    And you might want to use the Ezpages Improved Menus mod, from Free Software Add Ons (link top-left on any forum page.)

    Rob

  3. #3
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Embed php template within another php template based on drop-down menu selection?

    An ez-page "chapter", with one portal page linked in a nav menu and 10-20 other pages accessible through the chapter's table of contents, should serve to organize your articles.

  4. #4
    Join Date
    Jan 2008
    Posts
    103
    Plugin Contributions
    0

    Default Re: Embed php template within another php template based on drop-down menu selection?

    Thanks for the suggestions, but I'm not quite sure that will work. Granted I'm not very familiar with the EZPage function, but I'd really like to make it as seamless as possible by keeping it to one page.
    I want to have all the articles stored at www.mysite.com/articles with each file name being like article001.php, article002.php, etc. For example:

    www.mysite.com/index.php?main_page=articles

    Articles

    Random text here to outline the purposes, etc.

    Drop down menu with list of all articles (article 1, article 2, etc.)

    ***Article content changes based on drop down menu***

    Back button

    I found a way to make it work with iframes, but I wasn't able to auto-adjust the height of the iframe to conform with the article, so I had to veto that idea, unless anyone else has some suggestions.

    Any other ideas?

  5. #5
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Embed php template within another php template based on drop-down menu selection?

    Is there a particular reason you need the article pages to be PHP instead of HTML, or is that just what you think you have to do?
    Is it important that the same "random outline text" stay at the top of the page?
    Is it important that the page as a whole not refresh when you select a new article? Why? If this is the case, you want javascript to do this (don't ask me how, I don't write js).

    With ez-pages, you could always repeat the outline text at the top of each page. There will be a table of contents at the top of the page showing which page you are on.

  6. #6
    Join Date
    Jan 2008
    Posts
    103
    Plugin Contributions
    0

    Default Re: Embed php template within another php template based on drop-down menu selection?

    They don't have to be php, I was just assuming that would be easiest to embed.

    I'd like to keep the random text and drop down menu at the top of each page so the user can select another article if desired.

    I don't mind the whole page refreshing, as long as it accomplishes the goal, but if it can be done without reloading the whole page I think it would be a better interface for the customer.

    Basically I thought it would be easier to put the articles in different php files (or text files) rather than having to create a separate EZ pages.

    It sounds like the EZ pages may be the only way to go.

  7. #7
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Embed php template within another php template based on drop-down menu selection?

    EZ-Pages would be by far the easiest way to go. You can do anything if you know how to write the code for it, but I would consider the cost/benefit ratio for different implementations of your articles content.
    You could turn the table of contents into a dropdown with CSS (it might require installing the Ez-pages Improved TOC mod to have the elements to apply styling to).

  8. #8
    Join Date
    Jan 2008
    Posts
    103
    Plugin Contributions
    0

    Default Re: Embed php template within another php template based on drop-down menu selection?

    Thanks again for the help. I've been playing around with EZpages and think this will work for what I need. I'm only creating one main page, and really don't want a separate sidebox. How can I move the link to the main EZPage to the Information sidebox?

    Also, do you know if there is a way to display the TOC as a dropdown box? It's taking up too much of the page, especially if I end up having 30, 40, or more articles.

  9. #9
    Join Date
    Jan 2008
    Posts
    103
    Plugin Contributions
    0

    Default Re: Embed php template within another php template based on drop-down menu selection?

    Never mind about the link in the Information box...the simple solution is just to turn the EZPages box into the Information box by creating internal links and then disabling the information sidebox alltogether. If you happen to know about the dropdown menu I'm still searching for a solution on that.

  10. #10
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Embed php template within another php template based on drop-down menu selection?

    If we can see your site with the TOC, we can give the best advice for making it a dropdown.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 8 Feb 2011, 02:07 AM
  2. Image after selection drop down menu
    By badeend22 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 20 Dec 2008, 03:55 PM
  3. Product drop down menu selection?
    By fusionsp in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 20 Jun 2008, 07:22 PM
  4. Drop Down Menu for Selection
    By bajanboost in forum General Questions
    Replies: 0
    Last Post: 6 Jul 2007, 01:42 AM
  5. Template not showing on the drop down menu
    By ebbie in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 28 Jun 2006, 02:00 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR