Page 1 of 1

php not executing on page even with {literal} tags

Posted: Sat Feb 20, 2010 10:55 am
by zeroality
Please see http://www.pokemontopaz.net/testvb2 - as you can see, it has the chdir php code at top then a php call in the body but doesn't display anything.

http://www.pokemontopaz.net - you can see that I am using an iframe right now to get that news feed to display (this was before I knew about {literal} tags), and I put the same code in the testvb2 page that is on the announceframe.php page so I don't know why it's not working. If you need additional information or code, let me know.

Re: php not executing on page even with {literal} tags

Posted: Sat Feb 20, 2010 11:24 am
by reneh
Its mostly never good to use php-code in content.
Try to put the php code in a User Defined Tag (UDT)
See
http://wiki.cmsmadesimple.org/index.php ... fined_Tags

Re: php not executing on page even with {literal} tags

Posted: Sat Feb 20, 2010 12:13 pm
by zeroality
I see. I put the content php code in a tag and called the tag. That returned an error so I went to the template and replaced the php code there with a tag as well. Now there's two errors.

http://www.pokemontopaz.net/testvb2/

Let me know if you need any more info or what code I used. Thanks.

Re: php not executing on page even with {literal} tags

Posted: Sat Feb 20, 2010 9:32 pm
by nhaack

Warning: require_once(login_inc2test.php) [function.require-once]: failed to open stream: No such file or directory in ....

The error says that the script can not open what you try to include. Is the path to the file you try to include correct?

Best
Nils

Re: php not executing on page even with {literal} tags

Posted: Sat Feb 20, 2010 11:36 pm
by zeroality
Yes it is correct because I am running practically the exact same thing on http://www.pokemontopaz.net/testvb/, except that the php code is in an external .php file which the iframe calls.

Re: php not executing on page even with {literal} tags

Posted: Mon Feb 22, 2010 7:00 am
by zeroality
Any ideas?

Re: php not executing on page even with {literal} tags

Posted: Mon Feb 22, 2010 11:07 am
by cyberman
Why do you want to use {literal} tags? literal tags are only for javascript and css.

http://www.smarty.net/manual/en/languag ... iteral.php

If you want to add php inside a template activate the config param in config.php so you can use

Code: Select all

{php}
...
{/php}
http://www.smarty.net/manual/en/languag ... on.php.php

How have you tried to call the function annouceframe.php inside CMSms? Have you used the full serverside path?

You have to use the file path seen from CMSms root.

But be warned - like reneh said it's unsecure. You should better use a user defined tag or create a plugin.

Re: php not executing on page even with {literal} tags

Posted: Mon Feb 22, 2010 11:29 am
by zeroality
OK, I tried some new stuff and got a different error this time:
Fatal error: Call to a member function query_first() on a non-object in /home2/pokemont/public_html/login_inc2test.php on line 5
The index page is calling the announceframe.php page and displays it in an iframe. The announceframe.php page itself is simply this:

Code: Select all

<?php
   chdir('forums');
   require_once('global.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd" >
<__html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8">
<title>
Pokemon Topaz - vBulletin Announcements iFrame
</title>

<base target="_top">

<meta name="keywords" content="pokemon topaz, topaz text rpg, topaz rpg, pokemon rpg, pokemon text rpg, pokemon games, pokemon sprites, pokemon art, pokemon concept art, topaz sprites, topaz pokemon">
<meta name="description" content="Pokemon Topaz - An exciting fan-made RPG.">
<meta name="robots" content="all">

<link rel="stylesheet" media="all" type="text/css" href="iframe.css">

</head>

</__body>
<__script__ type="text/javascript" src="framed.js"></__script>
<?php
   require_once('login_inc2test.php');
?>
<__body>
</__html>
And it works just fine on the index page inside an iframe.

Re: php not executing on page even with {literal} tags

Posted: Mon Feb 22, 2010 12:03 pm
by cyberman
You try to get access to an vbulletin install, right?!

It's not the easiest thing to connect vbulletin (or some other big software) with CMSms.

Why you want to get now direct access to vbulletin inside CMSms? You can use the iframe or better the object html tags inside CMSms too. It's the fastest and easiest way.

Another idea could be to use RSS Feeds ... make a look if vbulletin announcement create a RSS feed. If yes you can show it inside CMSms (there are some modules in forge)
zeroality wrote: OK, I tried some new stuff and got a different error this time:
Fatal error: Call to a member function query_first() on a non-object in /home2/pokemont/public_html/login_inc2test.php on line 5
The same error if I call

http://www.pokemontopaz.net/login_inc2test.php

directly.

If I see your first post the file pathes cannot be correct. You've said you call announceframe.php directly (without any path) in an iframe. But your CMSms install is inside

http://www.pokemontopaz.net/testvb2/

This is the CMSms root (or not)?! And you tried to acess a file outside CMSms root!

Re: php not executing on page even with {literal} tags

Posted: Mon Feb 22, 2010 12:40 pm
by zeroality
My cms install is at http://www.pokemontopaz.net - you can see that by trying to access the control panel at http://www.pokemontopaz.net/admin

I don't understand why it works within an iframe on the home page but not when I use php directly (well, inside user defined tags).

Here is the code for the iframe:

Code: Select all

<p><__iframe name="newsframe" src="announceframe.php" height="420" frameborder="0" scrolling="no" width="95%"></__iframe></p>
So as you can see, the paths are indeed correct because it works on the index page. I also have this in my head tag:

Code: Select all

<base href="http://www.pokemontopaz.net/">
I made another login_inc file with the necessary php call at top and it works:

http://www.pokemontopaz.net/login_inc3test.php

I had to add:

Code: Select all

   chdir('forums');
   require_once('global.php');
which is in the announceframe.php as you can see from my above post. I just tried calling login_inc3test.php from the testvb2 page and it didn't work either so it is a CMSMS issue, not anything from my end, apparently.

The reason for wanting to resolve this is because a) it is mostly considered bad web design practice to use an iframe, or frames in general and b) because I want the stylesheet switcher to work on the news tables so I can skin it for the Midnight skin as opposed to being stuck with one color theme.

I don't want to use RSS feeds but I will look into object html tags. In the meantime, it would be nice if anybody had any other suggestions or ideas.

Re: php not executing on page even with {literal} tags

Posted: Tue Feb 23, 2010 5:01 am
by zeroality
I looked up object tags and I don't see how that would help? Can you explain?

Re: php not executing on page even with {literal} tags

Posted: Tue Feb 23, 2010 7:33 am
by cyberman
html object tag puts out valid xhtml and you can use it like an iframe

http://www.w3schools.com/TAGS/tag_object.asp

Example:

Code: Select all

<object name="newsframe" width="95%" height="420" data="announceframe.php" type="application/xhtml+xml"></object>

Re: php not executing on page even with {literal} tags

Posted: Tue Feb 23, 2010 7:48 am
by zeroality
I see. Yeah, I tried that and it did work. However, it does not solve my skinning problem. I'd like to get this going directly from CMSMS without referring any external pages other than the script.

Re: php not executing on page even with {literal} tags

Posted: Wed Feb 24, 2010 6:23 pm
by cyberman
In cause embedding vbulletin inside CMSms some pathes are wrong or not completely, so it cannot work.