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 "<div width="100%" align="center"><OBJECT id="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"><param name="fileName" value=""<{/php}><{$picture_url}>"<{php}> echo "><param name="animationatStart" value="false"><param name="transparentatStart" value="true"><param name="autoStart" value="false"><param name="showControls" value="true"><PARAM NAME="ShowPositionControls" VALUE="true"> <PARAM NAME="ShowAudioControls" VALUE="true"><PARAM NAME=ShowDisplay" VALUE="false"><PARAM NAME="EnableTracker" VALUE="true"><PARAM NAME="ShowTracker" VALUE="true"><PARAM NAME="ShowStatusBar" VALUE="true"><param name="loop" value="true"><embed type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" id="MediaPlayer1" displaysize="4" autosize="-1" bgcolor="darkblue" showcontrols="true" showtracker="1" showdisplay="0" showstatusbar="1" videoborder3d="-1" width="400" height="70" src=""<{/php}><{$picture_url}>"<{php}> echo " autostart="false" designtimesp="5311" loop="true"></embed></OBJECT></div> ";} else { echo"";}    



 
if ($ext == "wmv" or $ext == "WMV" or $ext == "avi" or $ext == "AVI" )  { echo "<div width="100%" align="center"> <OBJECT id="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"><param name="fileName" value=""<{/php}><{$picture_url}>"<{php}> echo "><param name="animationatStart" value="false"><param name="transparentatStart" value="true"><param name="autoStart" value="false"><param name="showControls" value="true"><PARAM NAME="ShowPositionControls" VALUE="true"> <PARAM NAME="ShowAudioControls" VALUE="true"><PARAM NAME=ShowDisplay" VALUE="false"><PARAM NAME="EnableTracker" VALUE="true"><PARAM NAME="ShowTracker" VALUE="true"><PARAM NAME="ShowStatusBar" VALUE="true"><param name="loop" value="true"></OBJECT>  <embed type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download" id="MediaPlayer1" displaysize="4" autosize="-1" bgcolor="darkblue" showcontrols="true" showtracker="1" showdisplay="0" showstatusbar="1" videoborder3d="-1" width="436" height="343" src=""<{/php}><{$picture_url}>"<{php}> echo " autostart="false" designtimesp="5311" loop="true"></embed><br /></div> ";} else { echo"";}     



if ($ext == "flv" or $ext == "FLV" or $ext == "swf" or $ext == "SWF" )  { echo"<div width="100%" align="center"><table width="400" align="center" border="0" height="335"><tbody><tr><td align="center" bgcolor="#000000"><div id="container"><embed type="application/x-shockwave-flash" src="mediaplayer.swf" style="" id="mediaplayer" name="mediaplayer" quality="high" allowfullscreen="true" flashvars="width=436&amp;height=343&amp;file=";<{/php}><{$picture_url}>"<{php}> echo " width="436" height="343"></div></td></tr></tbody></table></div>";} 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

269 user(s) are online (160 user(s) are browsing Support Forums)


Members: 0


Guests: 269


more...

Donat-O-Meter

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

Latest GitHub Commits