Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Linking in css?

  1. #1
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Linking in css?

    Hi all,

    I'd like to ask something.

    I have a stlye.css and that is linked to about 80 html pages.These 80 html pages are summaries of lesson. I have a div its id="pagead" on the top of all 80 pages. When i change style.css all 80 pages changes in relation with css. But i would like to show advertisements in this div and make it a link to another site. But there is no option for making link in css.

    How can i overcome this?

    Is there a piece of code which enables me to insert link code and it makes all 80 pages' div redirect to link?

    Maybe java can do this if i can give div id to java code. But i dont know how to do that...
    Thank you....

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Java is not javascript. Unfortunately you'll have to add the link to each page manually. Many html editors have a mass find and replace feature you could use. I know Dreamweaver has one.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New Coder
    Join Date
    Feb 2007
    Location
    Albany, Oregon
    Posts
    66
    Thanks
    3
    Thanked 0 Times in 0 Posts
    You could use php's include function to add the same content to a div on many pages. Unfortunately though you would have to change the extension for every page that you are using to .php in order for that to work.

    Here's how it would work though:

    example.php:

    Code:
    <p>Here is a paragraph that I want to include on many pages.</p>
    page1.php:

    Code:
    <div id="pagead">
    <?php include ("example.php"); ?>
    </div>
    page2.php:

    Code:
    <div id="pagead">
    <?php include ("example.php"); ?>
    </div>
    and so on for all 80 pages...

    The resulting code sent to the browser for page1.php and page2.php would be:

    Code:
    <div id="pagead">
    <p>Here is a paragraph that I want to include on many pages.</p>
    </div>

  • #4
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <?php include ("example.php"); ?>

    this is the code thank you very much, solved it thanks


  •  

    Posting Permissions

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