Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

How to wrap a php image link ?

vrijvlindervrijvlinder Papillon-Sauvage MVP

Hi, I am making an alternate module to the UserInfo Module to go on the Panel instead of the Content area and organizing it nice. I have one problem though and that is I need to wrap the image from Symbol edit in a < dd > so it lines up nice in the grid. It guessing but it bonked me so I think I need some pointers.

Below is the link I want to wrap in < dd > . I am sure it is something obvious but I would like to learn to do this well and for other things. I did this to the world flags plugin so the flag would show in the proper place. Bellow is the image link for Symbol Edit. How would you wrap it ?

echo Img("plugins/SymbolEdit/design/images/" . $symboldir . "/" . $SymbolUser . ".png", array('alt' => 'Symbol', 'title' => '', 'class' => "Symbol"));

Tagged:

Comments

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    I was able to figure this out by echoing the < dd > as bellow.

    echo "<dd>";  echo Img("plugins/SymbolEdit/design/images/" . $symboldir . "/" . $Sender->User->SymbolUser . ".png", array('alt' => 'Symbol', 'title' => '', 'class' => "SymbolProfileSize")); echo "</dd>";  
    

    This will work with anything you want to add to that dl . If you make plugins that add info or images to that list, I recommend you add those < dt > and < dd > so it shows nicely.

  • Options

    echo Wrap(Img("plugins/SymbolEdit/design/images/" . $symboldir . "/" . $Sender->User->SymbolUser . ".png", array('alt' => 'Symbol', 'title' => '', 'class' => "SymbolProfileSize")) ), 'dd');

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    hgtonighthgtonight ∞ · New MVP
    edited May 2014
    echo Wrap(
      Img(
        "plugins/SymbolEdit/design/images/{$symboldir}/{$SymbolUser}.png",
        array(
          'alt' => 'Symbol',
          'title' => '',
          'class' => "Symbol"
        )
      ),
      'dd');
    

    EDIT - Cross-post. You can use the Wrap() function if you ever want to wrap a string in an opening and closing tag. Also check out WrapIf() for even better markup. :D

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options
    peregrineperegrine MVP
    edited May 2014

    :p beat you to it :)

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    Ah ! that looks better for sure. I spent the last hour trial and error guessing. Took me 10 bonks to get it sort of right...

    I will try that one instead. You know I really don't like the way the About section displays in 2.1 , it looks very disorganized as opposed to the box in 2.0

    Hopefully this module will fill in that need for someone as it does for me.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    @peregrine said:
    echo Wrap(Img("plugins/SymbolEdit/design/images/" . $symboldir . "/" . $Sender->User->SymbolUser . ".png", array('alt' => 'Symbol', 'title' => '', 'class' => "SymbolProfileSize")) ), 'dd');

    This one bonked was the first I tried... but only because of stupid mistake missing parenthesis in this part ... "SymbolProfileSize")) ), 'dd');

    Yours @hgtonight , did not show the image but did wrap the link in dd

  • Options
    hgtonighthgtonight ∞ · New MVP

    @vrijvlinder said:
    Yours hgtonight , did not show the image but did wrap the link in dd

    I didn't do a sanity check on the string you originally posted. Sorry about that :(

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    @hgtonight said:
    I didn't do a sanity check on the string you originally posted. Sorry about that :(

    Yea it's ok I replaced the stuff so it shows, both work to add the< dd >in any case which is what I was looking for .

    Thanks :D

Sign In or Register to comment.