Issue with CMS moving to new server - PHP error

Hi, everyone. I built my site with a simple PHP-based CMS called Perch. I’m a graphic/web designer who can fiddle with a little PHP but I don’t write it.

The site is working perfectly on my test server but I’m having problems with it when I try to make it live on my new server. I stupidly built the site in a subfolder so I had to go through and remove all mentions of my subfolder from my code. I knew there might be issues with my database because of the subfolder issue, so I just started over with a brand new database (after much trying to get the old database to work). All of my Perch PHP is working except one page where I’m getting “Fatal error: Cannot use string offset as an array in /home/public_html/filename.php on line 142” I’ve triple checked that the PHP for that page is the same as on my test server, with only my subdomain name removed from the code.

I’m ready to go live with this site but I can’t do it without this page working! The Perch support folks are in the UK and are very slow to respond and not a huge amount of help. I’m getting desperate here. I can’t even think of a reason why this might be happening in only one area of the site but not others.

I’m even willing to hire someone to do this for me but I don’t know anyone I can count on with PHP expertise. I’m happy to copy/paste code if you like - just not sure what you’d like to see. Any ideas or help would be GREATLY appreciated.

Post the code.

Ok, the actual error is:

Fatal error: Cannot use string offset as an array in /home/djgould/public_html/podcastdetail.php on line 142

Here’s the relevant code from that page. (The line that’s getting the error - Line 142 - is the first instance of ‘value’=>$current_item[0][‘date’], in the //Display previous item section. But, again, this code works fine on my test server as is.)

[code]

<?php // Find current item $current_item = perch_content_custom('Podcasting listing', array( 'skip-template'=>true, 'filter'=>'slug', 'match'=>'eq', 'value'=>perch_get('s') ), true); // Display previous item perch_content_custom('Podcasting listing', array( 'filter'=>'date', 'match'=>'lt', 'value'=>$current_item[0]['date'], 'sort'=>'date', 'sort-order'=>'DESC', 'count'=>1, 'template'=>'prev_link.html' )); ?>
<?php $opts = array(

‘template’=>‘podcastdetail.html’,
‘filter’=>‘slug’,
‘match’=>‘eq’,
‘value’=>$_GET[‘s’]
);
perch_content_custom(‘Podcasting listing’, $opts);
?>

<?php

// Find current item
$current_item = perch_content_custom(‘Podcasting listing’, array(
‘skip-template’=>true,
‘filter’=>‘slug’,
‘match’=>‘eq’,
‘value’=>perch_get(‘s’)
), true);

// Display previous item
perch_content_custom(‘Podcasting listing’, array(
‘filter’=>‘date’,
‘match’=>‘lt’,
‘value’=>$current_item[0][‘date’],
‘sort’=>‘date’,
‘sort-order’=>‘DESC’,
‘count’=>1,
‘template’=>‘prev_link.html’
));

// Display next item
perch_content_custom(‘Podcasting listing’, array(
‘filter’=>‘date’,
‘match’=>‘gt’,
‘value’=>$current_item[0][‘date’],
‘sort’=>‘date’,
‘sort-order’=>‘ASC’,
‘count’=>1,
‘template’=>‘next_link.html’
));

?>

<?php

// Find current item
$current_item = perch_content_custom(‘Podcasting listing’, array(
‘skip-template’=>true,
‘filter’=>‘slug’,
‘match’=>‘eq’,
‘value’=>perch_get(‘s’)
), true);

// Display next item
perch_content_custom(‘Podcasting listing’, array(
‘filter’=>‘date’,
‘match’=>‘gt’,
‘value’=>$current_item[0][‘date’],
‘sort’=>‘date’,
‘sort-order’=>‘ASC’,
‘count’=>1,
‘template’=>‘next_link.html’
));

?>

[/code]

There’s also a little php that brings in the title of the page, inside the tags on that page, but I don’t know if that’s useful:

[php]<?php
$opts = array(
‘template’=>‘podcasttitle.html’,
‘filter’=>‘slug’,
‘match’=>‘eq’,
‘value’=>$_GET[‘s’]
);
perch_content_custom(‘Podcasting listing’, $opts);
?>[/php]

That page links to a few .html pages where the Perch code is included. Here’s podcastdetail.html:

[code]

<perch:content id=“title” type=“text” label=“Podcast title” required=“true” />
Share

<perch:content id=“slug” type=“slug” for=“title” suppress=“true” />[/code]

This is what’s in prev_link.html:

<div id="podcastdetailboxnavprev"><a href="podcastdetail.php?s=<perch:content id="slug" type="slug" for="title" />"><img src="img/prevarrow.png" alt="Prev episode"></a></div><!-- end PODCASTDETAILBOXNAVPREV --> 

This is what’s in next_link.html:

<div id="podcastdetailboxnavnext"><a href="podcastdetail.php?s=<perch:content id="slug" type="slug" for="title" />"><img src="img/nextarrow.png" alt="Next episode"></a></div><!-- end PODCASTDETAILBOXNAVNEXT -->
Sponsor our Newsletter | Privacy Policy | Terms of Service