How to wrap a php image link ?

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

  • 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.

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

  • hgtonighthgtonight 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

  • peregrineperegrine MVP
    edited May 2014

    :p beat you to it :)

  • 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.

  • @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

  • @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 :(

  • @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.