php includes or SSI

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
eglwolf
Posts: 70
Joined: Mon 12. Apr 2004, 01:23

php includes or SSI

Post by eglwolf »

I have some snippets of code I want use include in certain areas, and I want to use either php includes, or SSI. but no matter what I try and code it with neither one show up.

What and I missing on this?
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

Post by pSouper »

go on be a devil and give us a little more to go on ;)
can you post the code or a desensitised example of the code?
Last edited by pSouper on Fri 30. Apr 2004, 13:50, edited 1 time in total.
kpimichael
Posts: 44
Joined: Mon 29. Dec 2003, 03:29

Re: php includes or SSI

Post by kpimichael »

eglwolf wrote:I have some snippets of code I want use include in certain areas, and I want to use either php includes, or SSI. but no matter what I try and code it with neither one show up.

What and I missing on this?
It is something simple... just recheck the tags and pathing... remember that you have to put the whole path in if you are not keeping the code where Oliver does. I use it all the time... It is a great feature... Here is an example

Code: Select all

{PHP:/home/stuff/public_html/system/where.php}
Hope this helps.
machrobby
Posts: 7
Joined: Sat 24. Apr 2004, 09:45
Location: Italy
Contact:

Post by machrobby »

if I insert this tag...

Code: Select all

{PHP:where.php}
in which folder i must put where.php file ??
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

Post by pSouper »

the root dir

I believe ALL replacement tags with the exception of the {IMAGE:} family of repTags are reletive to the root dir.

{IMAGE:} Family are reletive to the PICTURES dir
machrobby
Posts: 7
Joined: Sat 24. Apr 2004, 09:45
Location: Italy
Contact:

Post by machrobby »

i have included {PHP:my_external.php} in a content;
my_external.php in root dir;

Warning: include_ext_php(my_external.php) [function.include-ext-php]: failed to create stream: No such file or directory in /home/web/www.sporteconomy.it/website/include/inc ... nc.inc.php on line 1062

Warning: include_ext_php() [function.include-ext-php]: Failed opening 'my_external.php' for inclusion (include_path='.:/usr/share/php/PEAR') in /home/web/www.sporteconomy.it/website/include/inc ... nc.inc.php on line 1062

:(
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

Post by pSouper »

try stripping the _ from the name
this may be automatically stripped in the processing of the replacement tag and therefore returning a file not found error
machrobby
Posts: 7
Joined: Sat 24. Apr 2004, 09:45
Location: Italy
Contact:

Post by machrobby »

nothing
... Failed opening 'myexternal.php' ...
:cry:
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

Post by pSouper »

I wonder if your external.php is doing something that phpwcms doesn't like it
to as a {PHP:} included file.

if you link to the file from an article it works as a self contained thing right?
eglwolf
Posts: 70
Joined: Mon 12. Apr 2004, 01:23

Post by eglwolf »

Perfect, that is exactly what I needed - thanks!
Haaid
Posts: 18
Joined: Sun 18. Apr 2004, 15:23
Location: Brissels, Belgium

Post by Haaid »

I am struggeling with the same problem; I have included a quotes script which should be called from the directory.

Code: Select all

{PHP:/home/.kale/salonphi/salonphilosophique.net/wcms/quotes/quotation.php}
I included the above in my template but I get an error saying:

Code: Select all

Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/.kale/salonphi/salonphilosophique.net/wcms/quotes/quotation_includes.php on line 30
Error:
This file is something which is called from the quotation.php file but when pointing my browser to the quotationfile directly, i do not get an error, only when including the file through the template.

any clues/pointers?
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

Post by pSouper »

would you post or pm the code?
Haaid
Posts: 18
Joined: Sun 18. Apr 2004, 15:23
Location: Brissels, Belgium

Post by Haaid »

code of exactly which php file?


cheers,

K.
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

Post by pSouper »

quotation.php
Haaid
Posts: 18
Joined: Sun 18. Apr 2004, 15:23
Location: Brissels, Belgium

Post by Haaid »

Code: Select all

<?php

############################################################################
############################################################################
##                                                                        ##
## This script is copyright Rupe Parnell (Starsol.co.uk) 2004.            ##
##                                                                        ##
## Distribution of this file, and/or any other files in this package, via ##
## any means, withour prior written consent of the author is prohibited.  ##
##                                                                        ##
## Starsol.co.uk takes no responsibility for any damages caused by the    ##
## usage of this script, and does not guarantee compability with all      ##
## servers.                                                               ##
##                                                                        ##
## Please use the contact form at                                         ##
## http://www.starsol.co.uk/scripts/contact.php if you need any help or   ##
## have any questions about this script.                                  ##
##                                                                        ##
############################################################################
############################################################################

require ('quotation_includes.php');

connect_to_mysql();

$how_many = mysql_num_rows(mysql_query("SELECT quotation FROM ".$db_prefix."quotations"));
$how_many_minus_one = $how_many - 1;

$random = rand(0,$how_many_minus_one);

$rq = mysql_fetch_array(mysql_query("SELECT quotation FROM ".$db_prefix."quotations LIMIT ".$random.", 1"));

$rq[quotation] = nl2br($rq[quotation]);

mysql_close();

$output = NULL;

$output = "<font style='font-family: ".$font_face."; font-size: ".$font_size."pt; color: ".$font_colour.";'>";

if ($bold){
	$output = $output . "<b>";
}
if ($italic){
	$output = $output . "<i>";
}
if ($underline){
	$output = $output . "<u>";
}

$output = $output . $rq[quotation];

if ($underline){
	$output = $output . "</u>";
}
if ($italic){
	$output = $output . "</i>";
}
if ($bold){
	$output = $output . "</b>";
}
$output = $output . "</font>";

echo $output;

?>
Post Reply