php instead of external js

Discussion in 'PHP' started by Lukas, Feb 1, 2007.

  1. #1
    since I am hearing that web surfers are having .js disabled more and more.

    is there a php script to write some lines of html..?

    basically, I have a webpage with an external js.. this js writes about 10 lines of html,( header, image and css menu link for SEO purposes..

    how can that be done with php..?

    I am a novice in php, so the full code & would be appreciated.
     
    Lukas, Feb 1, 2007 IP
  2. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Search engines don't read JS so you can't have content in a JS file. Whats the url so I can see what the JS file is doing?
     
    mad4, Feb 1, 2007 IP
  3. Kalyse

    Kalyse Peon

    Messages:
    1,221
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Use the <noscript> tag to add your content when JS is disable
     
    Kalyse, Feb 1, 2007 IP
  4. picouli

    picouli Peon

    Messages:
    760
    Likes Received:
    89
    Best Answers:
    0
    Trophy Points:
    0
    #4
    show us the JS and we'll probably be able to "translate" it to PHP
     
    picouli, Feb 1, 2007 IP
  5. alecs

    alecs Well-Known Member

    Messages:
    156
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    128
    #5
    Does the js write something based on some parameters or it writes the same thing in every case? Maybe yo do not need js or php at all.
     
    alecs, Feb 1, 2007 IP
  6. Lukas

    Lukas Well-Known Member

    Messages:
    1,299
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    130
    #6
    There is NO content in the external js...
    it is only the header and horizontal css nav menu that is being written. so, I don't need that for SEO..

    I only want php to wirte this same html since people sometimes have js turned off.

    I basically took out 20+ lines of code and want the spiders to see the meat, content a lot quicker.

    anyway, here it is below:

    ________________________

    document.write('<div class="nav1-container">'
    +'<div class="nav1">'
    +'<ul>'
    +'<li><a href="index.htm"><img border="0" src="img/home_wht.jpg" alt="Back to Home Page" width="48" height="20"></a></li>'
    +'<li><a href="contact.htm"><img border="0" src="img/contact_wht.jpg" alt="Contact Us" width="76" height="20"></a></li>'
    +'<li><a href="form.htm"><img border="0" src="img/blue.jpg" alt="" width="52" height="37"></a></li>'
    +'</ul>'
    +'</div>'
    +'</div>'
    +'<div class="site-name">'
    +'<p class="title"><a href="index.htm">okeydokey.net</a></p>'
    +'<p class="subtitle"><a href="index.htm">Prove Me Wrong</a></p>'
    +'</div>'
    +'<div class="site-slogan-container">'
    +'<div class="site-slogan">'
    +'<p class="title"></p>'
    +'<p class="subtitle"></p>'
    +'<p class="text">100\'s of Answers</p><br><br><br />'
    +'<p class="text">&rsaquo;&rsaquo;&rsaquo;&nbsp;<a href="form.htm">Find a Solution Now</a></p>'
    +'</div>'
    +'</div>'
    +'<div><img class="img-header" src="images/headers/people.jpg" width="770" height="150" border="0"></div>'
    +'<div class="nav2">'
    +'<ul>'
    +'<li><a href="program.htm">Program</a></li>'
    +'<li><a href="home.htm">Home</a></li>'
    +'<li><a href="answers.htm">Answers</a></li>'
    +'<li><a href="questions.htm">Questions</a></li>'
    +'</ul>'
    +'</div>
    _________________________
     
    Lukas, Feb 1, 2007 IP
  7. alecs

    alecs Well-Known Member

    Messages:
    156
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    128
    #7
    Relax, having those tags in html won't hurt your rankings. Place them directly in your html and forget about js.
    And with php you couldn't achieve the thing you are doing with js because php is a server-side language meaning that once the code is parsed and gets sent to the visitor/web crawler you cannot alter it.
     
    alecs, Feb 2, 2007 IP
  8. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #8
    Yes, definitely use the <noscript> tag for a javascript alternative. Putting SE's aside, there are users that disable javascript, and your site can be completely broken if you rely on javascript without any alternative.
     
    jestep, Feb 2, 2007 IP