1
ccrstudioweb
smart codes and PHP

Hi all,
I,m working on modules/xcgal/templates/xcgal_display.html

I added an php routine inside this file. But inside the <{php}><{/php}> I need one XOOPS variable <{$picture_url}> in order to get the file extension:

<{php}> $foto_temp = <{$picture_url}>; echo $foto_temp ; <{/php}>


If I use the former code I get a blank page.
So I,d tried to concatenate it:

<{php}> $foto_temp ".<{$picture_url}>."; echo $foto_temp ; <{/php}>


And I got:
.<>.

I´d tried this one as well:
<{php}> $foto_temp $picture_url; echo $foto_temp ; <{/php}>


And the variable $foto_temp got no value.

I need something like this:
<{php}> $foto_temp =  albums/userpics/10001/Sussurros.wmv  
; echo $foto_temp ; <{/php}>


I´ve been using XOOPS 2.0.18
Any idea?
Thanks in advanced!
Claudio Reis

2
ghia
Re: smart codes and PHP
  • 2009/10/29 16:36

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


$this->get_template_vars('picture_url')

I have no clue what you are trying to accomplish, but writing PHP code in the templates is not the intention of a template system.
You should add your PHP code in /displayimage.php and assign your result variable to the template in the same way and place as picture_url.

3
ccrstudioweb
Re: smart codes and PHP

THANK YOU GHIA!!!!!!!!!

That´s it!!!

In return I explain:
I will explode the url in order to get the file extention. And depending on the file extention, the xcgal prints an apropriate player

<{php}>
$foto_temp $this->get_template_vars('picture_url');  
$ext end(explode("."$foto_temp));  

if (
$ext == "mp3" or $ext == "MP3" or $ext == "wma" or $ext == "WMA"  or $ext == "au" or $ext == "AU" )  { echo "100%" align="center">MediaPlayer1" width="400" height="70" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"><{$picture_url}>"<{php}> echo "> <{$picture_url}>"<{php}> echo " autostart="false" designtimesp="5311" loop="true">
 ";} else { echo"";}    



 if ($ext == "wmv" or $ext == "WMV" or $ext == "avi" or $ext == "AVI" )  { echo "100%" align="center"> MediaPlayer1" width="436" height="343" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"><{$picture_url}>"<{php}> echo ">   <{$picture_url}>"<{php}> echo " autostart="false" designtimesp="5311" loop="true">
 ";} else { echo"";}     



if ($ext == "flv" or $ext == "FLV" or $ext == "swf" or $ext == "SWF" )  { echo"100%" align="center">400" align="center" border="0" height="335">center" bgcolor="#000000"><{$picture_url}>"<{php}> echo " width="436" height="343">
";} else { echo"";}       <{/php}>
:

4
ghia
Re: smart codes and PHP
  • 2009/10/30 0:18

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Seems very useful!
Little hint:
if (in_array(strtoupper($ext), array('MP3''WMA','AU')))
for only one compare.

Login

Who's Online

432 user(s) are online (55 user(s) are browsing Support Forums)


Members: 0


Guests: 432


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits