PHP support for Portal Widgets

Go down

PHP support for Portal Widgets

Post by BlTEBlTE on Wed Apr 04, 2012 5:38 pm

I wana do a widget to detect JTV streams online or not and obviously that is not the job for html, so Widgets supporting PHP would be epic.
Here is a short scratch on what I intend - maybe someone knows any other way how to realise this as a widget???

Code:
 
 function LiveOrNot($feedurlstr) {
        global $result;
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $feedurlstr);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $output = curl_exec($ch);
        curl_close($ch);     

        $string = "PP['channel_live'] = true";
        if(strstr($output,$string)) {
        $result = "live";
        } else {
        $result = "notlive";
        }
        return $result;
    }
      $live = LiveOrNot("http://lv.twitch.tv/blteblte/");
      (if $live == "live")
{
      echo "<b>Live stream is ONLINE!</b><br />";
      echo "<a href="http://lv.twitch.tv/blteblte/" class="postlink" target="_blank" rel="nofollow">BLTEBLTE</a>";
}
      else echo "<b>Live stram is OFLINE</b>";
avatar
BlTEBlTE
New Member

Posts : 19
Reputation : 1
Language : English, Latvian, Russian, c++, Corel Draw

Back to top Go down

Re: PHP support for Portal Widgets

Post by Zenn on Wed Apr 04, 2012 9:51 pm

Hi!

You ever tried to put between the Script tags?
avatar
Zenn
New Member

Posts : 5
Reputation : 1
Language : Portuguese
Location : Brazil

http://shiftactive.blogspot.com/

Back to top Go down

Re: PHP support for Portal Widgets

Post by Jophy on Thu Apr 05, 2012 3:10 am

Questions should be asked on the support sections => Topic Moved
avatar
Jophy
ForumGuru

Male Posts : 17924
Reputation : 835
Language : English
Location : Somewhere

Back to top Go down

Re: PHP support for Portal Widgets

Post by LGforum on Thu Apr 05, 2012 3:18 am

It is server side scripting it wouldn't work between script tags lol Razz

No php isn't supported unfortunately. You would need to host it on another site, and possibly display it using AJAX or another method.
avatar
LGforum
Hyperactive

Male Posts : 2263
Reputation : 260
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Re: PHP support for Portal Widgets

Post by BlTEBlTE on Thu Apr 05, 2012 7:01 am

@LGforum wrote:It is server side scripting it wouldn't work between script tags lol Razz

No php isn't supported unfortunately. You would need to host it on another site, and possibly display it using AJAX or another method.
ofc not between scipt tags, but between <?php?> lol - its not a script. It is code in programming language with variables.
This is topic for suggestion section - not scripting problems it has nothing to do about..., there is no problem in scripting.


The idea was when creating a portal widget -> create a php namespace which could include then php functions. This would add option to add variables, allow to use basic programming constructions like if (), for (), while (), etc... - which helps to solve most of jobs done by easy way...

EXAMPLE: site to 1 of Company of Heroes Clan: http://atomic.forumo.org
Idea is to have a WIDGET which will display whenever ANY streaming chanel predefined by Atomic Clan members is LIVE or NOT and link to them...

working examples: http://gamereplays.org/companyofheroes
full syte example: http://broadcast.fulltimegeek.de/

I know the easy way to do it via PHP code. If anyone has another way to get that GADGET on my PORTAL plz share it...., otherwise topic remains to SUGGESTION FORUM to add PHP namespaces creating Portal widgets....

What comes to AJAX suggestion - It would be anough 4me to reloaded widget when page gets reloaded.... so no need much.
avatar
BlTEBlTE
New Member

Posts : 19
Reputation : 1
Language : English, Latvian, Russian, c++, Corel Draw

Back to top Go down

Re: PHP support for Portal Widgets

Post by LGforum on Thu Apr 05, 2012 11:38 am

Believe me I know plenty about PHP.
No need to explain.

And I'm reffering to cross domain AJAX known as CORS. It's currently the only way possible to use PHP on your FM forum, I know because I do it.

But essentially, to me the ability to add PHP directly to FM would be meaningless with no SQL connection and control over forms and other things.

But again you can do what you want by hosting it externally and displaying it on your FM forum via AJAX.
avatar
LGforum
Hyperactive

Male Posts : 2263
Reputation : 260
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Re: PHP support for Portal Widgets

Post by BlTEBlTE on Thu Apr 05, 2012 12:58 pm

thx - good tips. gona try something....
avatar
BlTEBlTE
New Member

Posts : 19
Reputation : 1
Language : English, Latvian, Russian, c++, Corel Draw

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum