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.
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    New Coder
    Join Date
    Jun 2010
    Posts
    19
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Very Basic--Replace Text Link with Image Link

    I am new to php and find myself struggling through the most remedial tasks, like this one...

    All I want to do is replace the text link "DETAIL" with an image link of my choice (an image is much more attractive than text). I have been trying for about two hours to fix this, with no progress...UG!

    here is the code:

    Code:
    $html.=' <a rel="{handler: '."'iframe'".', size: {x: 700, y: 400}}" class="modal" href="index.php?option=com_osemsc&view=membership&id='.$sdata->id.'&layout=summary&tmpl=component">'.JText::_("DETAIL").' </a><br/>';

    Any help would be immense.

    Zechariah

  • #2
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    628
    Thanks
    51
    Thanked 67 Times in 67 Posts
    How do you plan on changing the image? Does it get changed with a button click or with a form or in the URL or randomly when the page loads or what?

  • #3
    New Coder
    Join Date
    Jun 2010
    Posts
    19
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Its not going to be a rollover image or anything interactive (besides the link). It will just be a static png or gif image of a button that says detail.

    here is the page it's on: http://www.turningpointweb.com/index...on-and-payment (it's towards the bottom under *Website Packages)

    Zechariah

  • #4
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    628
    Thanks
    51
    Thanked 67 Times in 67 Posts
    So just an image link? You already have a whole bunch of image links on your page, it's really just basic html. If you want to keep it inside the PHP tags, all you would do is add slashes before the "s.
    PHP Code:
    <?php
    $myImage 
    "<a href=\"http://mywebsiteurl.com\"><img src=\"myimage.png\" /></a>";
    ?>

  • #5
    New Coder
    Join Date
    Jun 2010
    Posts
    19
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I don't mean to be a bother or over-presumptuous, but to save myself more torture, how exactly would the code you referenced look integrated into the existing code?

    PHP Code:
    $html.=' <a rel="{handler: '."'iframe'".', size: {x: 700, y: 400}}" class="modal" href="index.php?option=com_osemsc&view=membership&id='.$sdata->id.'&layout=summary&tmpl=component">'.JText::_("DETAIL").' </a><br/>'
    Last edited by turningpoint; 07-02-2010 at 12:46 AM.

  • #6
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    628
    Thanks
    51
    Thanked 67 Times in 67 Posts
    Well what is your existing code trying to do? It looks like a bunch of html tags piled together in a variable for some unknown reason. If all that you're trying to do is the image link, then all you need is the original code I gave you. I'm not sure what you're trying to do with a rels and iframes.
    Last edited by djh101; 07-02-2010 at 01:03 AM.

  • #7
    New Coder
    Join Date
    Jun 2010
    Posts
    19
    Thanks
    3
    Thanked 0 Times in 0 Posts
    That code is from Open Source Excellence's Membership Control program extension. The "DETAIL" link , or [Detail] as it shows up on the live page, is a link to a pop-up that gives additional information about the particular Website Package. It seems thier code is a bit sloppy since I have around 70 errors on the page and my newsflash doesn't appear on the page this code is on... but that's another project.

    You can test it's functionality here: http://turningpointweb.com/index.php...on-and-payment (bottom of page next to shopping cart).

    All I am wanting to do is replace the [Detail] text-link on the page with an image-link to the pop-up. The rest of that code needs to stay, it's just the portion that relates to the [Detail] ("DETAIL") that I would like to change.

    Does that make sense?

    Zechariah
    Last edited by turningpoint; 07-02-2010 at 01:04 AM.

  • #8
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    628
    Thanks
    51
    Thanked 67 Times in 67 Posts
    Oh, I see. Well, JText defines text so you can't really put an image inside it. What you would probably have to do is change all the code around and replace JText with an <img src="">. I don't use Joomla (or any CMS for that matter), so I guess I'm probably the wrong person to be helping you with this.
    Last edited by djh101; 07-02-2010 at 01:14 AM.

  • #9
    New Coder
    Join Date
    Jun 2010
    Posts
    19
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by djh101 View Post
    You could try replacing "Detail" with <img src="">
    Ya you would think so huh? That's what I've tried (i'm new with php so I may have done it wrong). Seems like a simple switch... I dunno, any other suggestions?

  • #10
    New Coder
    Join Date
    Jun 2010
    Posts
    19
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I'm too novice to switch all the code around unfortunately. I understand basic html, but php is all greek to me with all the . and $ and &... I may just be putting a ' where a " should be. It's very tedious with my knowledge level.

  • #11
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    628
    Thanks
    51
    Thanked 67 Times in 67 Posts
    I only work with raw php, I have no idea how to use a CMS or how a CMS works. JText is where the text in your link is, though, so what you would want to do is replace JText with an image. Try this:
    PHP Code:
    $html.=' <a rel="{handler: '."'iframe'".', size: {x: 700, y: 400}}" class="modal" href="index.php?option=com_osemsc&view=membership&id='.$sdata->id.'&layout=summary&tmpl=component">'."<img src=\"http://upload.wikimedia.org/wikipedia/en/a/ab/Joomla_logo.png\">".' </a><br/>'
    Replace the src image with your image. It's hard to tell exactly what you're trying to do with just the variable and not the code where the variable is being called (and again without having any sort of idea the use or JText or Joomla), but it should display the image as a link.

  • Users who have thanked djh101 for this post:

    turningpoint (07-02-2010)

  • #12
    New Coder
    Join Date
    Jun 2010
    Posts
    19
    Thanks
    3
    Thanked 0 Times in 0 Posts
    You did it my friend. You are officially the man. Thank you so much. Kudos to you and an official thank you on the forums.

    I really appreciate you hanging in there with me and dialoging back and forth.

    Zechariah

  • #13
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    628
    Thanks
    51
    Thanked 67 Times in 67 Posts
    Gonna leave it as the Joomla image? Lol.

  • #14
    New Coder
    Join Date
    Jun 2010
    Posts
    19
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by djh101 View Post
    Gonna leave it as the Joomla image? Lol.
    ya I think it looks good.

  • #15
    New Coder
    Join Date
    Jun 2010
    Posts
    19
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Here's what all your hard work earned you... a little orange button. But hey, I think it looks way better than the text and so my torment is worth it.
    http://www.turningpointweb.com/index...on-and-payment

    Zechariah
    Last edited by turningpoint; 07-02-2010 at 02:42 AM.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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