How do I change text in [ ] to image links?

ajoyprabhu

Joined: 2002-09-26
Posts: 65
Posted: Tue, 2002-11-05 15:23

Hi all,

I am trying desperately to remove the text boxes that say [properties] and [print] and replace them with clickable images(icons). I need to put the following link in there...

$adminCommands .= "<a href=" $gallery->app->photoAlbumURL "/gallery_cards_send.php?photo_name=" $url '><img SRC="../modules/album/images/ecard.gif" ALT="Send an eCard"></a>'

...and for the [image properties]
$adminCommands .= '<a href="#" onClick="". popup("view_photo_properties.php?index=$index").''><img SRC="../modules/album/images/properties.gif" ALT="Image Details"></a>';

As you can tell, I am not good at PHP syntax!! Whats wrong with it guys??

Thanks in advance!

Ajoy

 
dtdgoomba

Joined: 2002-11-04
Posts: 185
Posted: Tue, 2002-11-05 16:36

for starters, just like you see for code already in place with HTML quotes, you need to 'escape' them, so that php prints out the quotes. otherwise it will think you are providing a string.

translation

<img src="file.jpg" border="0"> you need those before your html quotes you want printed

there may be more wrong after, but that was first glance :smile:

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Tue, 2002-11-05 17:39

dtdgoomba is correct. There are many ways to build up the strings. Here's one way:

$adminCommands .= "<a href="$gallery->app->photoAlbumURL/gallery_cards_send.php?photo_name=$url"><img SRC="../modules/album/images/ecard.gif" ALT="Send an eCard"></a>";

$adminCommands .= '<a href="#" onClick='
. popup("view_photo_properties.php?index=$index")
. '><img SRC="../modules/album/images/properties.gif" ALT="Image Details"></a>';

You can place variables inside strings to be expanded to their values (like in the first string above), but they must be inside "..." double quotes, and any double quotes in this string must be escaped with a "". You can use " without a backslash if you use it inside '...' single quotes, but variables won't be expanded inside these. Note that the second string uses the concatenation operator "." to join various bits together. (and the ".=" operator also joins on to the end). The original code was a bit confusing because the "."s blend in a little too much to be clear what's going on.

 
ajoyprabhu

Joined: 2002-09-26
Posts: 65
Posted: Tue, 2002-11-05 20:44

Thanks a ton for explaining the way the quotes work, but somehow it is not expanding the variable!

When I do this...
$adminCommands .= "<a href="$gallery->app->photoAlbumURL/gallery_cards_send.php?photo_name=$url"><img SRC="../modules/album/images/ecard.gif" ALT="Send an eCard"></a>";

It gives me...

Object->photoAlbumURL/gallery_cards_send.php and no URL concatenated to it!

:sad:

 
ajoyprabhu

Joined: 2002-09-26
Posts: 65
Posted: Tue, 2002-11-05 21:15

Nevermind guys, I figured it out!!

I needed to give spaces for the variable to be recognized. (duh!)

Ok, do you think people would be interested in this mod?

All it does is puts two lil icons instead of the text for visitors to print or send an ecard.

:smile:

Thanks again!

Ajoy

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Tue, 2002-11-05 21:32

:smile: Glad you got it working.
FYI, if you don't want spaces, you can use curly braces{}.
So if $variable is "defghi"
Then "abc${variable}jkl" will expand to "abcdefghijkl".

 
ajoyprabhu

Joined: 2002-09-26
Posts: 65
Posted: Tue, 2002-11-05 21:39

Oh thanks!

Course, I just went ahead and declared another variable that concatenated the whoel thing together and then put it in the <a href...>

Thanks again though, learnt somehting today!

:wink:
Ajoy

 
josephp

Joined: 2002-10-03
Posts: 172
Posted: Tue, 2002-11-05 23:15

Did you happen have a copy of the images and the file that modifed?

I would like to try put in my gallery

Thanks :grin:

 
ajoyprabhu

Joined: 2002-09-26
Posts: 65
Posted: Wed, 2002-11-06 18:59

OK DONE! Pull it off my web site guys..woever wants the mod.

http://www.apropos-it.com/ajoyprabhu

go to the downloads section to find it...while you are at it, let me know if you like my pictures by signing my guestbook! :smile:

The changes include, removing the [photoproperties], adding links for the others such as eCards, Printing on shutterlfy and slideshow link.

Please do let me know if you find any issues with it. The mods take into account that I am running it under postnuke...so please modify it according to taste!

:smile:

Ajoy

 
josephp

Joined: 2002-10-03
Posts: 172
Posted: Thu, 2002-11-07 08:47

You know your addon is cool but something is missing

No login link, thats a problem

 
ajoyprabhu

Joined: 2002-09-26
Posts: 65
Posted: Thu, 2002-11-07 14:34

I am confused! The is a login place and directly beow it it says, "Don't have an account Create one!

If you still don't see it, please let me know!

 
dtdgoomba

Joined: 2002-11-04
Posts: 185
Posted: Thu, 2002-11-07 17:22

I think it's because you separated the login from the gallery display. We're used to seeing it on the top right where the search box is for you, but you've stripped it out and placed it on the left side in the navigation panel. I thought the same thing at first when i went to your site. Where is the login? .. even though it was right there. I think people with less familiarity with gallery actually be able to find it faster than we did!

 
ajoyprabhu

Joined: 2002-09-26
Posts: 65
Posted: Thu, 2002-11-07 19:10

I am using postnuke and gallery as a module within it. Of course, I am also desperately trying to figure out as to how I can put ANOTHER module UNDER the album....

Any ideas? anyone?