SimplePortal

Customization => Custom Coding => Topic started by: NeoxII on December 04, 2010, 06:10:07 AM

Title: Custom PHP Button
Post by: NeoxII on December 04, 2010, 06:10:07 AM
Hi Simpleportal,
How can I create a custom PHP code Button with simple porta block utility?

With Simple Portal PHP Block this code don't work, in Display.template.php no problem...

Code: [Select]
//Gallery Button

echo '
<li>
<a href="' . $scripturl .  '?action=gallery;su=user;u='. $message['member']['id'] . '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/portfolio.png" class="gradualfader" alt="' . $txt[''] . '" title="' . $txt[''] . '"style="margin-top: 3px;"  />' : $txt['']), '</a></li>';

//END GalleryButton


Thank You!   :)
Title: Re: Custom PHP Button
Post by: grafitus on December 04, 2010, 07:06:53 AM
To globalize $scripturl, $settings, $txt variables, add following code to top of code:
Code: [Select]
global $scripturl, $settings, $txt;
But it won't work. Because $message variable is just defines in Display.template.php... Output like is that:
Quote
<li>
            <a href="SITE_URL?action=gallery;su=user;u="><img src="IMAGES_URL/portfolio.png" class="gradualfader" alt="" title=""style="margin-top: 3px;"  /></a></li>';

Maybe you will get a few error messages...
Title: Re: Custom PHP Button
Post by: NeoxII on December 04, 2010, 08:33:12 AM
Thank you grafitus, work perfect with this code:


Code: [Select]
global $scripturl, $message, $settings, $txt;

//Portfolio Button

echo '

<a href="' . $scripturl .  '?action=gallery;su=user;u='. $message['member']['id'] . '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/intro.jpg" class="gradualfader" alt="' . $txt[''] . '" title="' . $txt[''] . '"style=""  />' : $txt['']), '</a>';

//END Portfolio Button

There is only a problem, link redirect to:

-  http://mysite/index.php?action=gallery;su=user;u=

no to:

- http://mysite/index.php?action=gallery;su=user;u=1,2,3.... 4, 10, 20 member ID personal gallery.

Thank you very much!  :)
Title: Re: Custom PHP Button
Post by: NeoxII on December 05, 2010, 05:32:46 AM
To globalize $scripturl, $settings, $txt variables, add following code to top of code:
Code: [Select]
global $scripturl, $settings, $txt;
But it won't work. Because $message variable is just defines in Display.template.php... Output like is that:
Quote
<li>
            <a href="SITE_URL?action=gallery;su=user;u="><img src="IMAGES_URL/portfolio.png" class="gradualfader" alt="" title=""style="margin-top: 3px;"  /></a></li>';

Maybe you will get a few error messages...

Ok now I understand...
There is a system with another php block to globalize:

Code: [Select]
global $scripturl, $message, $settings, $txt;
or for example to:

Code: [Select]
include("Themes/default/Display.template.php");
Thank you very much!  :)
SimplePortal 2.3.8 © 2008-2024, SimplePortal