Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
PHP in templates
Goto page Previous  1, 2, 3, 4
 
Reply to topic    Forum Index » Additional Downloads View previous topic
View next topic
PHP in templates
Author Message
jackavin



Joined: 01 Oct 2008
Posts: 53

Post Reply with quote
i mean in template like full-story but i want it in comment section
Wed Apr 08, 2009 5:06 pm View user's profile Send private message
Guest








Please login to hide the ads.

Hawk



Joined: 29 Aug 2006
Posts: 159

Post Reply with quote
I guess you could use the Quick Tags tool from Options in administration panel & make something like that.

_________________
Oo
Thu Apr 09, 2009 10:28 am View user's profile Send private message Visit poster's website
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2973
Location: Germany

Post Reply with quote
Just adding this:
Code:
add_filter('news-comment', 'php_in_template');


below this:
Code:
add_filter('news-entry', 'php_in_template');


should work.
Fri Apr 17, 2009 1:35 pm View user's profile Send private message
jackavin



Joined: 01 Oct 2008
Posts: 53

Post Reply with quote
thank you it's working but one thing

when i user include("file"); the tag {comment} at include("file") can't be view.

but the in full news it does why that.


thank you FI-DD u awsome
Sun Apr 19, 2009 3:06 pm View user's profile Send private message
alex



Joined: 21 Aug 2008
Posts: 19

Post Reply with quote
After I save the template all the $ dissapears, the same happens with /$.What can I do?
Thu Apr 30, 2009 6:48 pm View user's profile Send private message
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2973
Location: Germany

Post Reply with quote
alex wrote:
the same happens with /$.

Use \$ instead of /$.
Tue May 12, 2009 3:25 pm View user's profile Send private message
alex



Joined: 21 Aug 2008
Posts: 19

Post Reply with quote
now is working, but when I use the following script it return this error: Parse error: syntax error, unexpected '"' in /home/domain/nw/plugins/php-in-templates.php(2Cool : eval()'d code on line 27
Code:
<?php

//...get direct FLV link for Dailymotion


//http://www.dailymotion.com/us/featured/channel/sport/video/x8kqo2_bsides-salto-base-nocturno-en-ensan_sport
//http://keepvid.com/?url=http://www.dailymotion.com/us/featured/channel/sport/video/x8kqo2_bsides-salto-base-nocturno-en-ensan_sport
//http://vid.akm.dailymotion.com/18/512x384/h264/14404610.h264?aksessionid=1236484818170_912376&akauth=1236657618_89762dcab95c2ecae031f3b333df7437


//\$geturl = \$video_detail->video_url; // retrieve video_url from the database
//\$geturl = "http://keepvid.com/?url=" . \$video_detail->video_url;
\$geturl = "http://keepvid.com/?url=http://www.dailymotion.com/video/x5cayu_walking-contradiction-green-day_music";


if(function_exists('curl_init'))
{
  \$ch      = curl_init();
  \$timeout = 30; // set to zero for no timeout
  curl_setopt(\$ch, CURLOPT_URL, \$geturl);
  curl_setopt(\$ch, CURLOPT_RETURNTRANSFER,1);
  curl_setopt(\$ch, CURLOPT_CONNECTTIMEOUT,\$timeout);
  \$file_contents = curl_exec(\$ch);
  curl_close(\$ch);
}

\$start_position = strpos(\$file_contents, "Links found on");
\$start_position = strpos(\$file_contents, "Report any problems to", \$start_position);
\$start_position = strpos(\$file_contents, "<a href=\"", \$start_position) + 9;
\$end_position   = strpos(\$file_contents, "\"", \$start_position) - \$start_position;
\$getflvlink     = substr(\$file_contents, \$start_position, \$end_position);
\$flv_link       = trim(\$getflvlink);

//\$flv_link = "http://proxy-35.dailymotion.com/16/320x240/flv/7746594.flv?3729391860564098ca7ed38576d57c4e13a7dae";
//\$flv_link = "http://vid.akm.dailymotion.com/18/512x384/h264/14404610.h264?aksessionid=1236484818170_912376&akauth=1236657618_89762dcab95c2ecae031f3b333df7437";

?>

<html>

  <head>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js"></script>

    <script type="text/javascript">
      var flashvars =
      {
        'file':                      encodeURIComponent('<?php echo \$flv_link; ?>'),
        'type':                     'video',
        'skin':                     'nacht',
        'controlbar':               'bottom',
        'stretching':               'fill',
        'frontcolor':               'FFFFFF',
        'lightcolor':               'FF6600',
        'autostart':                'true'
      };

      var params =
      {
        'allowfullscreen':          'true',
        'allowscriptaccess':        'always'
      };

      var attributes =
      {
        'name':                     'JomPlayerId1',
        'id':                       'JomPlayerId1'
      };

      swfobject.embedSWF('player.swf', 'JomTubePlayerId1', '430', '300', '9.0.124', false, flashvars, params, attributes);
    </script>

  </head>

  </body>

    <div id="JomPlayerContainer" class="JomPlayerContainer"><a id="JomTubePlayerId1" class="player1" href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Get the Adobe Flash Player to see this video.</a></div>

  </body>

</html>


if I include a page containing this script is working but if I use it in the template it return the error
Sat May 16, 2009 6:01 pm View user's profile Send private message
MiNi.SpIdEr



Joined: 22 Jan 2008
Posts: 78

Post Reply with quote
hiii

i activeed the plug but .... nothing happen !!! i try the eg. also nothing

Code:
tags: <?php echo 'blahblah'; ?>


actually i want put that
Code:
<?=cn_meta('keywords'); ?>
but nothing also
Code:
<?PHP=cn_meta('keywords'); ?>


any idea ??? coz the topic came too long with out on solve Sad


Rolling Eyes

_________________
WwW.MiNi-5pIdEr.CoM
Sun May 17, 2009 7:06 am View user's profile Send private message
GoldenGonaz



Joined: 04 Oct 2006
Posts: 32

Post Reply with quote
Hey guys, I am having a problem making things like {avatar} appear within <?php (there is more code to this, I have chopped most of it out to show simply what I mean.

<?php
$background="http://www.website.com/{avatar}.png";
?>

This doesn't seem to work? It doesn't replace {avatar} with what it should... I'm not really any good with php, so I'll try and explain what I think is happening as best and unfortunately incorrectly php wise as I can.

I think <?php is sort of executing before it can display the {avatar} part to cutenews. So cutenews doesn't see the {avatar} so can't replace it with what it would do it if weren't within <?php

Any help you can be would be very much appreciated Very Happy If my ""theory"" is right, is it possible to fix this? Or is it something totally different that's wrong!

Thanks
Fri Jul 10, 2009 12:50 pm View user's profile Send private message
riri



Joined: 21 Aug 2007
Posts: 52

Post Reply with quote
hello,

I'd like to know what it is for this plugin and how to operate?

thank you in advance
Wed Oct 28, 2009 7:28 am View user's profile Send private message
DarkSlim



Joined: 06 Aug 2009
Posts: 286
Location: IL

Post Reply with quote
For "GoldenGonaz":

As the first post says you need to 'escape the variables', so it should look like:

Code:
<?php
\$background="http://www.website.com/{avatar}.png";
?>


And for riri:

This plugin enables you to use php code in the templates of your CuteNewsRU
and not only regular html, this is usefull for includes (include another file) for example

To install download the Zip file from first post and put it in the plugins folder. Smile

Edit: Btw, you pretty much have to do this for it work:

Open: inc/show.news.php

Find:

Code:

$output = preg_replace('/\[full-link\](.*?)\[\/full-link\]/is', '', $output);


After add:

Code:

$output = preg_replace_callback('/<\\?php(.*?)\\?>/is', 'phpTemplateEval', $output);


_________________
Portfolio: www.Yaniv.tk

Some of my Plugins and Mods and more in the CuteNewsRU Index!

Donations Accepted, Thank you
Thu Oct 29, 2009 2:51 pm View user's profile Send private message Visit poster's website
riri



Joined: 21 Aug 2007
Posts: 52

Post Reply with quote
I understand thank you for the explanation:)
Thu Oct 29, 2009 3:41 pm View user's profile Send private message
GoldenGonaz



Joined: 04 Oct 2006
Posts: 32

Post Reply with quote
DarkSlim wrote:
For "GoldenGonaz":

As the first post says you need to 'escape the variables', so it should look like:

Code:
<?php
\$background="http://www.website.com/{avatar}.png";
?>



I have escaped all the variables, but when I do this is causes many errors in the php file I am including... is there a fix for this?


I receive this error: Warning: Unexpected character in input: '\' (ASCII=92) state=1
Thu Jul 08, 2010 6:15 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    Forum Index » Additional Downloads All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4
Page 4 of 4

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Music Lyrics.