You are here:  » pricesExternal path problem

Support Forum



pricesExternal path problem

Submitted by shabbysheep on Wed, 2011-02-16 12:57 in

Hello David,

A long time since my last post, I hope you are keeping well.

I am trying to set up paths to pricesExternal but I cannot remember exactly what the script should be. Whereami.php gives E:\Domains\o\mysite.co.uk\user\htdocs\ but that path doesn't seem to work (and doesn't look correct to me).

<?php
$common_path
="E:\Domains\o\mysite.co.uk\user\htdocs\";
$_GET["q"]="Kiddicare Taxi";
require(
$common_path."\pricesExternal.php");
?>

gives

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in E:\Domains\o\mysite.co.uk\user\htdocs\{link saved} on line 131

Parse error: syntax error, unexpected T_STRING in E:\Domains\o\mysite.co.uk\user\htdocs\{link saved} on line 131

I've forgotten much of what I learned last time I set up a site as you can tell, hopefully you can point me in the right direction.

Regards, shabbysheep

Submitted by support on Wed, 2011-02-16 13:06

Hi,

Within a double-quoted string in PHP the backslash acts as a "escape character", so in this case, the best thing to do would be to change it to a single-quoted string - have a go with:

$common_path='E:\Domains\o\mysite.co.uk\user\htdocs\';

Cheers,
David.
--
PriceTapestry.com

Submitted by shabbysheep on Wed, 2011-02-16 13:28

Hi David, Many thanks for your speedy reply. I have tried:

<?php
$common_path
='E:\Domains\o\mysite.co.uk\user\htdocs';
require(
$common_path."\pricesExternal.php");
?>

with the result:

Warning: require_once(E:\Domains\o\mysite.co.uk\user\htdocsconfig.php) [function.require-once]: failed to open stream: No such file or directory in E:\Domains\o\mysite.co.uk\user\htdocs\pricesExternal.php on line 38

Fatal error: require_once() [function.require]: Failed opening required 'E:\Domains\o\mysite.co.uk\user\htdocsconfig.php' (include_path='.;C:\php\pear') in E:\Domains\o\mysite.co.uk\user\htdocs\pricesExternal.php on line 38

I seem to recall you advised doubling up slashes when using a windows server - could that be a factor?

Submitted by support on Wed, 2011-02-16 13:37

Hi,

Using single-quotes eliminates the need for double-slashes; but that part of it looks to be working fine now. The error looks like it is actually referring to the file htdocsconfig.php (which I don't recognise) being required() at line 38 of your pricesExternal.php.

Could you check that line, and if it still required maybe it's the same issue regarding slashes - so you could try the same fix by using single-quotes instead...

If you're not sure, email me your pricesExternal.php and I'll check it out for you...

Cheers,
David.
--
PriceTapestry.com

Submitted by shabbysheep on Wed, 2011-02-16 14:17

Hello David,

Line 38 calls for config.php - sounds OK!

Tried this:

<?php
$common_path
='E:\Domains\o\mysite.co.uk\user\htdocs';
require(
$common_path.'\pricesExternal.php');
?>

With the result:

{code saved}

Submitted by support on Wed, 2011-02-16 14:56

Hi,

Sorry I hadn't spotted that $common_path did not have a trailing "/" - the error messages make sense now! Have a go with...

<?php
$common_path
='E:\Domains\o\mysite.co.uk\user\htdocs\';
...
require($common_path.'
pricesExternal.php');
?>

Cheers,
David.
--
PriceTapestry.com

Submitted by shabbysheep on Wed, 2011-02-16 16:35

Hello David,

I'm getting:

Parse error: syntax error, unexpected T_STRING in E:\Domains\o\mysite.co.uk\user\htdocs\trenton-own-brand-pushchairs.php on line 132

Code generated by Rapidweaver: (Line 32 = require($common_path.'pricesExternal.php');

<?php
$common_path
='E:\Domains\o\mysite.co.uk\user\htdocs\';
require($common_path.'
pricesExternal.php');
?>

blocks_growparent('blocksPage');

Thanks

Submitted by support on Wed, 2011-02-16 16:48

Hi,

Have a go with the double-backslash version...

<?php
$common_path
="E:\\Domains\\o\\mysite.co.uk\\user\\htdocs\\";
require(
$common_path."pricesExternal.php");
?>

(don't forget to add back in your $_GET["q"] = "Product Name" line)

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by shabbysheep on Wed, 2011-02-16 17:28

Thanks David,

Added:

<?php
$common_path
="E:\\Domains\\o\\mysite.co.uk\\user\\htdocs\\";
$_GET["q"] = "Kiddicare.com Taxi Pushchair Black";
require(
$common_path."pricesExternal.php");
?>

And received:

Warning: require(E:\Domains\o\mysite.co.uk\user\htdocs\pricesExternal.php) [function.require]: failed to open stream: No such file or directory in E:\Domains\o\mysite.co.uk\user\htdocs\trenton-own-brand-pushchairs.php on line 132

Fatal error: require() [function.require]: Failed opening required 'E:\Domains\o\mysite.co.uk\user\htdocs\pricesExternal.php' (include_path='.;C:\php\pear') in E:\Domains\o\own-brand-pushchairs.co.uk\user\htdocs\trenton-own-brand-pushchairs.php on line 132

Many thanks for your time David.

Submitted by support on Thu, 2011-02-17 09:33

Hi,

This is really strange as the paths look fine, and I just double checked that pricesExternal.php exists on your server. As they're actually in the same directory, could you have a go using an empty string for $common_path, for example:

  $common_path = "";

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by shabbysheep on Thu, 2011-02-17 14:26

Thanks David,

Tried this (is this correct?):

<?php
$common_path
="E:\\Domains\\o\\mysite.co.uk\\user\\htdocs\\";
$_GET["q"] = "Kiddicare.com Taxi Pushchair Black";
require(
$common_path." ");
?>

And received:

Warning: require(E:\Domains\o\mysite.co.uk\user\htdocs\ ) [function.require]: failed to open stream: No such file or directory in E:\Domains\o\own-brand-pushchairs.co.uk\user\htdocs\trenton-own-brand-pushchairs.php on line 132

Fatal error: require() [function.require]: Failed opening required 'E:\Domains\o\mysite.co.uk\user\htdocs\ ' (include_path='.;C:\php\pear') in E:\Domains\o\mysite.co.uk\user\htdocs\trenton-own-brand-pushchairs.php on line 132

Shabbysheep

Submitted by support on Thu, 2011-02-17 14:29

Hi,

Sorry - it should be the $common_path variable that is empty - have a go with:

<?php
$common_path
="";
$_GET["q"] = "Kiddicare.com Taxi Pushchair Black";
require(
$common_path."pricesExternal.php");
?>

Cheers,
David.
--
PriceTapestry.com

Submitted by shabbysheep on Thu, 2011-02-17 14:59

Hi David,

I now get:

Parse error: syntax error, unexpected '=' in E:\Domains\o\own-brand-pushchairs.co.uk\user\htdocs\trenton-own-brand-pushchairs.php on line 366

Rapidweaver reports:

(PHP) Parse error, unexpected '=' in - on line 131

129

<?php
130 $common_path
="";
131 $_GET["q"]&nbsp;=&nbsp;"Kiddicare.com&nbsp;Taxi&nbsp;Pushchair&nbsp;Black";
132 require($common_path."pricesExternal.php");
133 
?>

The whole themed page is broken using the latest code. Previously it displayed with the error message where the price table should be.

Submitted by support on Thu, 2011-02-17 15:06

Hi,

That looks like you might be using a visual editor which is breaking the PHP - I think that's what's happening here...

Notice how the spaces between $_GET["q"] and the value have been replaced by &nbsp; - that is something that some visual editors do.

Check for a setting that enables you to edit the HTML directly (for example tabs at the top of the page that let you switch between HTML and visual mode) - that should be all it is! The PHP code should appear exactly as:

<?php
 $common_path
="";
 
$_GET["q"] = "Kiddicare.com&nbsp;Taxi&nbsp;Pushchair&nbsp;Black";
 require(
$common_path."pricesExternal.php");
?>

Cheers,
David.
--
PriceTapestry.com

Submitted by shabbysheep on Thu, 2011-02-17 15:29

Thanks David, Rapidweaver uses themes, this appears to be the first one I have come across which breaks the PHP. Rapidweaver has three ways of dealing with generated code, default, tidied and optomized. I think last time choosing tidied worked, but not with the current theme. Another option may be to put the PHP into a themeless page in an iframe. As I'm not a coder I'll try a few options within Rapidweaver. Many thanks for all your recent help.