Results 1 to 7 of 7

Thread: parse erors in ajax link

  1. #1
    Join Date
    Feb 2008
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default parse erors in ajax link

    I am trying to use the dynamic ajax content script from DD.
    I would like toreference php variables to select the conten to load.
    I cant reslove my parse errors in writingout the a href tag.
    Can anyone help please?
    Code:
     ?>
    	<a href="javascript:ajaxpage(<?php' ./$p1'?>, 'contentarea');><img src=<?php './images/{$book['pix']}'?> border='0' width='80' height='100'/></a>"
        
      	<div id="contentarea"></div>
      	<?php

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Well, I think that you would need to echo it:
    Code:
     ?>
    	<a href="javascript:ajaxpage(<?php echo' ./$p1'; ?>, 'contentarea');><img src=<?php echo './images/{$book['pix']}'; ?> border='0' width='80' height='100'/></a>"
        
      	<div id="contentarea"></div>
      	<?php
    Jeremy | jfein.net

  3. #3
    Join Date
    Feb 2008
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Nile View Post
    Well, I think that you would need to echo it:
    Code:
     ?>
    	<a href="javascript:ajaxpage(<?php echo' ./$p1'; ?>, 'contentarea');><img src=<?php echo './images/{$book['pix']}'; ?> border='0' width='80' height='100'/></a>"
        
      	<div id="contentarea"></div>
      	<?php
    Hi Nile, thanks for that.
    It works in part.
    This works;

    <a href="javascript:ajaxpage('<?php echo $p1?>', 'contentarea');">Link</a>

    However, the image tag screws it up with a parse error, code below
    Code:
    <a href="javascript:ajaxpage('<?php echo $p1?>', 'contentarea');"><img src=<?php echo './images/{$book['pix']}'; ?> border='0' width='80' height='100'/></a>
    Any suggestions welcome.

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Try this:
    PHP Code:
    <a href="javascript:ajaxpage('<?php echo $p1?>', 'contentarea');"><img src=<?php echo './images/{$book[\'pix\']}'?> border='0' width='80' height='100'/></a>
    Jeremy | jfein.net

  5. #5
    Join Date
    Feb 2008
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks. Tried it and got an image box but no image. checked varaible has image reference and it does, so not finding the path i guess.
    Tried a variation also (below) to no avail.
    cant think of what to try next?
    Code:
    <a href="javascript:ajaxpage('<?php echo $p1?>', 'contentarea');"><img src="<?php echo "/images/".$book['pix']; ?>" border='0' width='80' height='100'/></a>

  6. #6
    Join Date
    Feb 2008
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi Nile. Added a . and it works.Many thanks for your help.Code below
    Code:
    <a href="javascript:ajaxpage('<?php echo $p1?>', 'contentarea');"><img src="<?php echo "./images/".$book['pix']; ?>" border='0' width='80' height='100'/></a>

  7. #7
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Your welcome!
    Jeremy | jfein.net

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
  •