Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7
  1. #1
    Junior Member
    Join Date
    Apr 2011
    Posts
    4
    Member #
    27488
    I have designed a web site page template using a CSS, so that when I use the template for multiple pages in the site, I can change the characteristics of all the pages in one fell swoop.

    My question lies in the changing of text... Say I have a basic navigation menu on every page that is comprised of numerous lines of text-hyperlinks: How can I then use CSS or something else to change a menu option without doing it in each and every page?

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,720
    Member #
    5580
    Liked
    718 times
    You don't use CSS for the dynamic changes, you use PHP.

    That means you either have to change your page extensions from .html to .php
    or use .htaccess to command the server to process .html files as PHP scripts.

    Then, you have a PHP script (perhaps you call it "menu.php"), that is "included" on
    the template page. The PHP script called "menu.php" generates the HTML/CSS and
    content you need for any given page, and since it's included in your template, it is
    executed each time the template is displayed. Wherever you insert the "PHP include"
    statement in your template determines where the menu is displayed. PHP puts in
    the HTML needed for the menu.

    When your template loads, the PHP script called "menu.php" looks at the URL and
    determines which menu options to display, or how to modify the "look" of them.
    Because it's included in the template, it automatically displays what it needs to display.

    An example of this is the forum you are looking at right now.
    The menu options are based on your login (what you are allowed to access). I have
    some menu options on this page that you don't have ... because I'm a WDF Staff member.
    Which posts are displayed is based on the coding you see in the URL.

    .
    LeenkzMike likes this.


  4. #3
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    You don't necessarily have to use PHP for something like this. If your needs are relatively simple, then you might want to look into Server-side HTML, or SHTML. Basically, you "include" your menu file as mlseim suggested.

    Or if you really don't want includes at all, you could solve this with any editor that has a global find/replace function that searches across directories. Here's my personal favorite...and don't freak when you see Microsoft in the URL, because it's legitimately free.

    You do have options, but none of them involve CSS.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  5. #4
    Junior Member
    Join Date
    Apr 2011
    Posts
    4
    Member #
    27488
    Thanks for the input guys. I am using dreamweaver (I should have mentioned) and I've now discovered the Template function, where a master file automatically makes changes to any defined child pages. Thanks again for the help

  6. #5
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    I generally prefer mlseim's method. I don't know spit about php, but the includes function is a huge time saver. I never even considered SHTML. Of course, I didn't realize it had an include function either...
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  7. #6
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,720
    Member #
    5580
    Liked
    718 times
    PHP is a scripting language (server-side) ... programmable.

    I don't know of any web hosts that allow executable commands using SHTML.
    Includes are basically the only thing most of them allow.

    .


  8. #7
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    I guess that depends on your host... shtml has been supported on every host I've ever used, but includes are probably the most efficient way of creating and maintaining "repeatable structures" of links for navigation, headers, footers, etc... and they are supported on every scripting PHP, ASP, ASP.NET, etc....


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:58 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com