SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast Crockett's Avatar
    Join Date
    Jan 2002
    Location
    Miami FLA
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    document.write("<?php include(" ? ? ? ? ? ?

    Hi all

    Quick question -

    I'm using the wacookie extention for dreamweaver to set a cookie w/ a visitor's company name.

    On another page I check the cookie and have added an IF cookie = value, write some html. Everything works great when i'm just writing some text. I've tested between 2 cookie values and they both work fine.

    When however I attempt to document.write a php include, I dont get anything in the browser...

    ----- code that works fine -----
    if (rubiconHelp.getValue("cname") == "kslc") {
    document.write("hello world");
    }



    ----- code no work worth a hoot -----
    if (rubiconHelp.getValue("cname") == "kslc") {
    document.write("<?php include("_kslc.php"); ?>");
    }

    Its a QUOTES issue, right ? ?

    If so, what can i do to document.write a php include ?

    thx in advance

  2. #2
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A few questions.

    -= Does the page you're trying this on have a php or php3 extension?

    -= What does the source code say after the page is loaded? Viewing the source on a PHP page after it loads can REALLY help you determine what's gone wrong.

    -= You might need to escape the " in the incldue statement.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  3. #3
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    swap "" with '

    or escape the quotes in the include that are the same as the outter quotes in the javascript

    and creole was too fast for me to reply

  4. #4
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    -= You might need to escape the " in the incldue statement.
    creole remember the server will return the page etc inside the include so that wont need escaping, but it's good practice too. Wats inside the include?

  5. #5
    SitePoint Enthusiast Crockett's Avatar
    Join Date
    Jan 2002
    Location
    Miami FLA
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    follow up

    first off, thx for response...

    doc is a .php

    source code shows all of the code from the include but its not showing up. I went ahead and replaced all " w/ ' on in include file and made sure that there were no extra line breaks.

    still not working, but i see that the code is on the page, it IS being included

    How do I exclude the "'s ?

  6. #6
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if the things not too large maybe i could see what your doing

    you have this rite

    document.write("<?php include("_kslc.php"); ?>");

    use this instead

    document.write('<?php include("_kslc.php"); ?>');

    on the include

    do it like this



    \'blahblah\' \'blahblah\' \'blahblah\' \'blahblah\'
    \'blahblah\' \'blahblah\' \'blahblah\' \'blahblah\'
    \'blahblah\' \'blahblah\' \'blahblah\' \'blahblah\'
    \'blahblah\' \'blahblah\' \'blahblah\' \'blahblah\'
    \'blahblah\' \'blahblah\' \'blahblah\' \'blahblah\'

    "\'s ? "\'s ? "\'s ? "\'s ? "\'s ? "\'s ? "\'s ? "\'s ?
    "\'s ? "\'s ? "\'s ? "\'s ? "\'s ? "\'s ? "\'s ? "\'s ?
    "\'s ? "\'s ? "\'s ? "\'s ? "\'s ? "\'s ? "\'s ? "\'s ?
    "\'s ? "\'s ? "\'s ? "\'s ? "\'s ? "\'s ? "\'s ? "\'s ?
    "\'s ? "\'s ? "\'s ? "\'s ? "\'s ? "\'s ? "\'s ? "\'s ?
    the " doesn't need to be escaped as it's only use in the php which doesn't show in the code.

  7. #7
    SitePoint Enthusiast Crockett's Avatar
    Join Date
    Jan 2002
    Location
    Miami FLA
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Got it!

    Thx all - it was due to the "" and '' issue, extra spaces between tags, as well as some extra lines at start and end of include...

    psyched i got it workin and thanx all for help

  8. #8
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    np


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
  •