Forum

Thread tagged as: Problem, Error

Moving page to folder

Seem to having a problem creating new pages and moving to different location.

Creating a new page in root and displays ok but when trying to move to new folder get:-

( ! ) Notice: Undefined offset: 1 in C:\wamp\www\callanetics\perch\core\apps\content\PerchContent_Page.class.php on line 296
Call Stack
#   Time    Memory  Function    Location
1   0.0000  260408  {main}( )   ..\index.php:0
2   0.0566  2973112 include( 'C:\wamp\www\callanetics\perch\core\apps\content\modes\page.edit.pre.php' )    ..\index.php:32
3   0.0616  3327272 PerchContent_Page->move_file( ) ..\page.edit.pre.php:124

File shows in folder list as moved to new folder but accessing the file from new location:-

( ! ) Warning: include(C:\wamp\www\callanetics\perch\templates\pages): failed to open stream: Permission denied in C:\wamp\www\callanetics\information\privacy-policy.php on line 1
Call Stack
#   Time    Memory  Function    Location
1   0.0000  239176  {main}( )   ..\privacy-policy.php:0

( ! ) Warning: include(): Failed opening '..\perch\templates\pages' for inclusion (include_path='.;C:\php\pear') in C:\wamp\www\callanetics\information\privacy-policy.php on line 1
Call Stack
#   Time    Memory  Function    Location
1   0.0000  239176  {main}( )   ..\privacy-policy.php:0

Have tried adding the path when first creating page but the file is still created in root and gives a 404 as page not in folder location. Trying then to move give "A page file already exists at the new location."

Have read the section when getting a server error and the runtime page code is:-

<?php include(str_replace('/', DIRECTORY_SEPARATOR, 'perch/templates/pages/main-flexible-content.php')); ?>

which shows the correct page located in root and the code for the moved page is:-

<?php include(str_replace('/', DIRECTORY_SEPARATOR, '..\..\perch\templates\pages')); ?>

when changed to:-

<?php include(str_replace('/', DIRECTORY_SEPARATOR, '../perch/templates/pages/main-flexible-content.php')); ?>

page displays as expected!

Diagnostics report
HEALTH CHECK

Perch is up to date
PHP 5.5.12 is up to date
MySQL 5.6.17 is up to date
Image processing available
SUMMARY INFORMATION

Perch: 2.8.7, PHP: 5.5.12, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: bf9ad53b11c9a57efdb1057292d73b928b8c5c77 $, with PDO
Server OS: WINNT, apache2handler
Installed apps: content (2.8.7), assets (2.8.7), categories (2.8.7)
App runtimes: <?php $apps_list = array( 'content', 'categories', );
PERCH_LOGINPATH: /perch
PERCH_PATH: C:\wamp\www\callanetics\perch
PERCH_CORE: C:\wamp\www\callanetics\perch\core
PERCH_RESFILEPATH: C:\wamp\www\callanetics\perch\resources
Image manipulation: GD
PHP limits: Max upload 64M, Max POST 3M, Memory: 128M, Total max file upload: 3M
Resource folder writeable: Yes
HTTP_HOST: callanetics.dev
DOCUMENT_ROOT: C:/wamp/www/callanetics
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php

regards Rob

Rob Willox

Rob Willox 0 points

  • 6 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Looks like a permissions issue with your local setup.

Checked and it looks like the code when page is moved to folder is not formatted right.

When page move to folder the code for the moved page is:-

<?php include(str_replace('/', DIRECTORY_SEPARATOR, '..\..\perch\templates\pages')); ?>

when changed to:-

<?php include(str_replace('/', DIRECTORY_SEPARATOR, '../perch/templates/pages/main-flexible-content.php')); ?>

page displays correctly showing correct path in url.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Is this always on Windows, or are you moving between environments?

Not moving between environments. Dev site running on windows7 64bit version of wamp with virtual server & staging domain:- https://webmedia.webhop.biz/

Drew McLellan

Drew McLellan 2638 points
Perch Support

What steps are you following to move the page?

File showing in root.

  1. Open page in admin
  2. Open page options
  3. Add new folder /new folder/file-name.php
  4. Tick 'Move page to this location' box
  5. Submit

File shows in new location in file system but gives the runtime error when accessed.

An update:-

Created a new page and on Page options added folder path. Menu url shows full folder page option but page remains in root. Obviously get a 404.

Again created new page and on Page option added folder path & ticked move the page to this location, get

( ! ) Notice: Undefined offset: 1 in C:\wamp\www\callanetics\perch\core\apps\content\PerchContent_Page.class.php on line 296
Call Stack
#   Time    Memory  Function    Location
1   0.0000  260416  {main}( )   ..\index.php:0
2   0.0468  2973200 include( 'C:\wamp\www\callanetics\perch\core\apps\content\modes\page.edit.pre.php' )    ..\index.php:32
3   0.0624  3325968 PerchContent_Page->move_file( ) ..\page.edit.pre.php:124

Page shows in correct folder but the page code shows as

<?php include(str_replace('/', DIRECTORY_SEPARATOR, '..\..\perch\templates\pages')); ?>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Thanks for the steps - I'll see if I can reproduce it.