The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

PHP support for Portal Widgets

View previous topic View next topic Go down

PHP support for Portal Widgets

Post by BlTEBlTE on April 4th 2012, 6: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>";

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 April 4th 2012, 10:51 pm

Hi!

You ever tried to put between the Script tags?

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 April 5th 2012, 4:10 am

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

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 April 5th 2012, 4: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.

LGforum
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Re: PHP support for Portal Widgets

Post by BlTEBlTE on April 5th 2012, 8: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.

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 April 5th 2012, 12:38 pm

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.

LGforum
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Re: PHP support for Portal Widgets

Post by BlTEBlTE on April 5th 2012, 1:58 pm

thx - good tips. gona try something....

BlTEBlTE
New Member

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

Back to top Go down

View previous topic View next topic Back to top


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