TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,231
  • Total Topics: 21,353
  • Online today: 391
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 509
  • Total: 510
  • lurkalot

Help needed: How do i add this button with php code to a block ?

Started by knat, December 19, 2006, 02:09:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

knat

I need help with this

I have the bookmarks mod installed for SMF and i would like to add the button in a block

the code for the button looks like this

if ($context['user']['is_logged'])
echo ($current_action == 'Bookmarks' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'Bookmarks' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=Bookmarks">' , $txt['my_bookmarks'] , '</a>
</td>' , $current_action == 'Bookmarks' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


How do i add that code to a picture of my choise and stick it in a php block ??

The bookmarks action will only work when i use this code.. wich is for the normal smf menu and i dont have that anymore.. so any help would make me happy and thankful  :)

JPDeni

Looks like it would just be


global $scripturl;

echo '<a href="', $scripturl, '?action=Bookmarks"><img src="http://url/to/the/image" /></a>';


You wouldn't want to use the if ($context['user']['is_logged']) conditional because then guests would just see an empty block. Better to only have it viewable for logged-in members.

knat

Thanks alot.. i really sux at the php lol

what if i want to put this code inside some html

i have to use something called php tags ?

Sorry for being a newb  :)

JPDeni

Quotewhat if i want to put this code inside some html
I don't know what you mean. Other html code around it?

If that's what you mean, there are two ways. One is to put the html code within the echo statement. As long as you don't have a ' in there, it won't be a problem. The other way is to hardcode the url to your page instead of using the $scripturl variable.

It would be:


<a href="http://www.yoursite.com/index.php?action=Bookmarks"><img src="http://url/to/the/image" /></a>


knat

goin to www.mysite.com/index.php?action=bookmarks

That dont work.. only way i can get it to work is if i use the above php code.. thats why i was aking about how to convert it to html.. does it contain session id or something ?

knat

OMG i really am the king of newb's  :buck2:

Reason why it wouldn't work was because i didn't use a capital B in bookmarks LoL  :uglystupid2:

Thanks for helping me out  ;)

JPDeni

Good job figuring it out. :) I was just writing that very thing.

You won't forget it next time.  ;D

This website is proudly hosted on Crocweb Cloud Website Hosting.