include doesn't work in user defined tags

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
willi
New Member
New Member
Posts: 3
Joined: Fri Apr 09, 2010 5:46 pm

include doesn't work in user defined tags

Post by willi »

Hello,

I have a little problem with using the php include() within user defined tags...

like in cmsms manual descriped you can add php code via user defined tags into your cmsms page. I tried hard, but it is not working.
This is the code I just wanna add:

Code: Select all

<?php $site="true"; include ("/home/www/web23/html/tristat/index.php");  ?>
Doing that end in the result, that the index.php script answers with a homepage instead of just a small text like "Statistics by TriStat"

Therefor I changed the code in the following, because with the following adress, it works in the firefox address line.

Code: Select all

 echo 'Start TriStat<br>' ;

include ("http://web23.mis19.de/tristat/index.php?site=name");

echo 'End TriStat' ;
When I go the the link via firefox I get the exspected answer, but the udt stops after "Start TriStat" and finishes.
Do have a clue why?
willi
New Member
New Member
Posts: 3
Joined: Fri Apr 09, 2010 5:46 pm

Re: include doesn't work in user defined tags

Post by willi »

I didn't used the Tag, like descriped in udt help...
the echo command works, why is the include command not working? Can I activate a debug flag for the include command to see, why it isn't working...
owr_bgld

Re: include doesn't work in user defined tags

Post by owr_bgld »

Do you have the Tag in your included file?
willi
New Member
New Member
Posts: 3
Joined: Fri Apr 09, 2010 5:46 pm

Re: include doesn't work in user defined tags

Post by willi »

The is in the included file.

The answer of the included php http://web23.mis19.de/tristat/index.php without the ?site=true is just a normal html page.
The answer of http://web23.mis19.de/tristat/index.php?site=true for the first time is

Code: Select all

 <font size='2' color='green'>This page was initialized!</font> 
and for the following times

Code: Select all

<font size='1' color='black'>
<a href='http://www.tristat.org' target='_blank'>tristat.org webstats</a>
</font><__script__ type='text/javascript' src='http://web23.mis19.de/tristat/index.php?jsip=92.225.227.162&time=1270902292'>
</__script>
There is no php script in the answer, just little text in html format.
The problem is, if I put the links in the firefox adress line, I get the expected answer, but when I include the link by the include command in an udt the cms system stops building the page after the include command, thats strange...
Last edited by willi on Sat Apr 10, 2010 1:33 pm, edited 1 time in total.
owr_bgld

Re: include doesn't work in user defined tags

Post by owr_bgld »

willi wrote: The is in the included file.
.... but when I include the link by the include command in an udt the cms system stops building the page after the include command, thats strange...
That's not strange - that's what to be expected when you include a file whitch has the tag inside, because it "kills" the rest of the script behind the ?> in the included file because the script thinks php is at end at this pint and not where it should be.

but that's not only in cmsms - that will be in every php-File when you have php after the included file.
Last edited by owr_bgld on Sat Apr 10, 2010 7:26 pm, edited 1 time in total.
kkreitz
Forum Members
Forum Members
Posts: 48
Joined: Fri Jun 25, 2010 3:06 am

Re: include doesn't work in user defined tags

Post by kkreitz »

I am having the same problem. Using CMSMS 1.7.1

I created a UDT:

my_phpinfo

and placed it into my home template between divs like this {my_phpinfo}

The code in the UDT is:

include ("/proplist/index.php");

where index.php is a php and html page

I am not a php developer so the explanation below I believe explains my dilema, however what is the solution to embed a php driven application (http://idevspot.com/PhpRealEstate.php) into a page in CMSMS?
That's not strange - that's what to be expected when you include a file whitch has the tag inside, because it "kills" the rest of the script behind the ?> in the included file because the script thinks php is at end at this pint and not where it should be.

but that's not only in cmsms - that will be in every php-File when you have php after the included file.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: include doesn't work in user defined tags

Post by calguy1000 »

I have 1 word for you.

Code: Select all

getcwd().
If you're doing PHP development of any sort, you're gonna have to learn some basics.  Including how paths work.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
kkreitz
Forum Members
Forum Members
Posts: 48
Joined: Fri Jun 25, 2010 3:06 am

Re: include doesn't work in user defined tags

Post by kkreitz »

Thank you for the one word, it is a start.

Unfortunately I am unable to accomplish my desired result which is to have a div container on the home page display the contents of of the php page that resides in a subdomain. My first thought was iframe however dynamically resizing the height does not seem to have a clean cross browser solution. Thus I chose the PHP include route and the CMSMS UDT of which you have appropriately identified is outside my area of experience.

All help with this is very much appreciated.

I have added your suggestion:

getcwd() .
include('proplist/index.php');

This now displays a combined page of the content however I have lost the styling and header information of the home page where this resides, and have also lost the images and styling of the included page.

I have scoured the forums and googled away, unfortunately I have not found a working solution.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: include doesn't work in user defined tags

Post by calguy1000 »

Then the include is working, and doing exactly what you told it to, you just don't know how things work.

include != iframe.

and this is not the place to teach you how to solve problems like this.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
kkreitz
Forum Members
Forum Members
Posts: 48
Joined: Fri Jun 25, 2010 3:06 am

Re: include doesn't work in user defined tags

Post by kkreitz »

Thank you, obviously I am trying to learn how things work. I followed a Google search to this subject line which was exactly my issue. I apologize for not recognizing that the category it was in was not the appropriate category. This was my first question in this forum and I will make sure to pay attention to the protocol more closely in the future.
kkreitz
Forum Members
Forum Members
Posts: 48
Joined: Fri Jun 25, 2010 3:06 am

Re: include doesn't work in user defined tags

Post by kkreitz »

So I believe I am in the appropriate forum category for this. I am going to restate my issue and see if there is a workable solution for me and my skill sets. I am NOT a PHP programmer, however I do come across the need to put PHP in and modify PHP code from time to time. Thank you CMS Made Simple for doing all of the heavy lifting.

I would like to display a PHP page (index.php) in a div container as part (not all) of my home page. The PHP page is both PHP and HTML. It sits in a sub directory of the main domain. The PHP page is a dynamic page and fluctuates in height.

I have successfully displayed it using an iframe. However the issue I have is SEO and the iframe limits in this area.

Is there a PHP include solution for this? If so can you show me an example of the exact code?

Thank you for your help in advance.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: include doesn't work in user defined tags

Post by calguy1000 »

Well, now you're describing (and in a much better way I may add) a much different problem.

You want to 'embed' one webpage within another.  (the best term is 'embed').

This is quite simple actually.... using the {fetch} plugin that is built into smarty (you can find it in the smarty manual).

However embedding another web page will (most likely) invalidate the resulting source
(you'll have one HTML page inside of another) and the code will not validate therefore you may have many cross browser issues to fix... not to mention having to do the styling to account for any classes and ids used in the embedded web source.

You do not need a UDT.  You do however have to have a firm grasp of what is happening
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
kkreitz
Forum Members
Forum Members
Posts: 48
Joined: Fri Jun 25, 2010 3:06 am

Re: include doesn't work in user defined tags

Post by kkreitz »

Yes, I can see there are issues after {fetch} that are currently beyond my skill set and experience. Thank you for your timely responses.
Post Reply

Return to “The Lounge”