SimplePortal
Customization => Custom Coding => Topic started 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...
//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! :)
-
To globalize $scripturl, $settings, $txt variables, add following code to top of code:
global $scripturl, $settings, $txt;
But it won't work. Because $message variable is just defines in Display.template.php... Output like is that:
<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...
-
Thank you grafitus, work perfect with this code:
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! :)
-
To globalize $scripturl, $settings, $txt variables, add following code to top of code:
global $scripturl, $settings, $txt;
But it won't work. Because $message variable is just defines in Display.template.php... Output like is that:
<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:
global $scripturl, $message, $settings, $txt;
or for example to:
include("Themes/default/Display.template.php");
Thank you very much! :)