dcsimg
www.webdeveloper.com
Results 1 to 5 of 5

Thread: Link for content

  1. #1
    Join Date
    Aug 2017
    Posts
    3

    Link for content

    Hi,
    I made a website and i need help.
    I want to make button for change my content. I don't want to copy the html page with all design for all pages and change the content. I want to have a main page with design and to link the content pages for about, contact, etc...
    I can do it? Someone can help me?

  2. #2
    Join Date
    Dec 2005
    Location
    TX
    Posts
    7,888
    Need more information than supplied.

    1. Can you create a "small" example of what you are trying to convert?
    Nothing more than a simple line or two fo the page displays?

    2. Do you have an example of what you are trying to create? A link somewhere?

    Your lack of design specifications leaves too much in the way of output outcomes.

  3. #3
    Join Date
    Aug 2017
    Posts
    3
    Quote Originally Posted by JMRKER View Post
    Need more information than supplied.

    1. Can you create a "small" example of what you are trying to convert?
    Nothing more than a simple line or two fo the page displays?

    2. Do you have an example of what you are trying to create? A link somewhere?

    Your lack of design specifications leaves too much in the way of output outcomes.
    I have this page : http://imgur.com/QNS5dCO
    If you see the link "base-index.html" i made 1 html full and a copy for all pages. I copy the base-index.html and i rename in istoric.html
    http://imgur.com/E0cUONF and i remove this part: http://imgur.com/a/PlE0d and i put this part: http://imgur.com/a/WYAvq .
    It's the same file : http://imgur.com/a/KVcFc and http://imgur.com/a/g5t8Q.
    I want when i press the button to load my content no redirect to other page. If i'm at home page and i press the "Despre Noi" button to remove this part http://imgur.com/a/PlE0d and load this part http://imgur.com/a/WYAvq for no need to copy same file for all pages. If i want to change a photo i need to change in all files for change for all website. I want like i can change design from home page and the contents from other files.
    If you can, you can send me if you have the id skype for i show you exactly what i want?

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    22,152
    If I understand correctly (not sure), you are either looking at using "server-side includes", or else building your site in a server-side language (such as PHP) where you can use "include" functions in that language to pull in the repeating portions of your pages from another file.

    head.html
    HTML Code:
    <!DOCTYPE html>
    <html>
    <head><title>My Site</title></head>
    <body>
    <div id="nav"><!-- html markup here for you site navigation --></div>
    <div id="main>
    foot.html
    HTML Code:
    </div>
    <p id="footer">Copyright 2017 by me</p>
    </body>
    </html>
    some_page.php
    PHP Code:
    <?php require 'head.html'?>
    <h1>This Is Some Page</h1>
    <p>Blah blah blah blah blah.</p>
    <?php require 'foot.php'?>
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  5. #5
    Join Date
    Mar 2012
    Posts
    3,945
    The simplest way to achieve what you want is with PHP include files. To use them you need to learn a little PHP:
    Say you have a file index.html that contains:

    HTML Code:
    <html>
    <head>
    </head>
    <body>
    <header>
    <!-- the header goes here -->
    </header>
    <menu>
    <!-- the main menu goes here -->
    </menu>
    <div id="content">
    <!-- content goes here -->
    </div>
    <footer>
    <!-- the footer goes here -->
    </footer>
    </body>
    </html>
    You want the header, menu and footer to be the same on every page, so you cut and paste them into two separate files:

    mymenu.html contains:
    HTML Code:
    <header>
    <!-- the header goes here -->
    </header>
    <menu>
    <!-- the main menu goes here -->
    </menu>
    <div id="content">
    <!-- content goes here -->
    </div>
    and myfooter.html contains:
    HTML Code:
    <footer>
    <!-- the footer goes here -->
    </footer>
    Then you rename index.html to index.php, and amend it to:
    HTML Code:
    <html>
    <head>
    </head>
    <body>
    <?php
    include "mymenu.html";
    ?>
    <div id="content">
    <!-- content goes here -->
    </div>
    <?php
    include "myfooter.html";
    ?>
    </body>
    </html>
    Then any changes to the header, menu or footer need only be made once in the respective include file. There, wasn't that easy? Well actually it is a little bit more complicated than that, but not much. The problem is that the PHP code actually run on the server. So it works fine when uploaded to your web server, but does not work in your browser. So to be able to test your code before you upload it, you need to set up a local server. Fortunately, this is also easy to do. For a windows platform, you need to download Wampserver from the net. It sets itself up. All you need to do is:
    1. Download and install Wampserver.
    2. Move your development area to C:\wamp\www (or wherever you have installed Wampserver).
    3. Create a shortcut to launch Wampserver, e.g. C:\wamp\wamp.exe
    4. Create a shortcut to launch the local copy of your web site, e.g. //localhost/index.php

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles