Forum
create a master page with the correct path
I am trying to create a master page that will allow me to create 'activity' pages in an 'activities' section of my site.
I followed along with the Creating Pages video.
Using the /en/conil/activities/index.php
page of the site I created a master activity.php page.
I added the sub navigation block to index.php and activity.php
<?php perch_pages_navigation(array(
'from-path' => '/en/conil/activities',
'levels' => 1));
?>
When I create a master page Perch creates the page, but at the wrong level /activty2.php
It creates the page with the template regions and the link in the new navigation section.
From the newly created navigation on index.php you can click through to the new page eg, activity2.php. It's just in the wrong place, and the new navigation in new page changes to reflect it's location?
If I manually change the path and move the page then the page is moved and the path shows correct in the generated html
<ul>
<li><a href="/en/conil/activities/activity2.php">activity2</a></li>
</ul>
However when I try and visit the page I get the following error
Warning: include(........\perch\templates\pages): failed to open stream: No such file or directory in C:\xampp\htdocs\sites\popp\public\en\conil\activities\activity2.php on line 1
Warning: include(): Failed opening '........\perch\templates\pages' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\sites\popp\public\en\conil\activities\activity2.php on line 1
Also when I alter the path in the Perch admin I get the following...
Notice: Undefined offset: 1 in C:\xampp\htdocs\sites\popp\public\perch\core\apps\content\PerchContent_Page.class.php on line 292
For reference here is the index and master page code
Index.php
<?php include('../../../perch/runtime.php'); ?>
<?php perch_layout('global/en/top', array(
'title'=>'Activities | Conil',
'body-class'=>'activities',
)); ?>
<!--/global-top-->
<?php perch_layout('global/en/local-nav', array(
'activities-class'=>'active',
'locality'=>'conil',
'section'=>'activities',
))?>
<div>
<?php perch_content('Activity Intro');?>
</div>
<div >
<h3>ACTIVITIES</h3>
<?php perch_pages_navigation(array(
'from-path' => '/en/conil/activities',
'levels' => 1));
?>
</div>
</div>
<?php perch_layout('global/en/bottom'); ?>
activity.php
<?php include($_SERVER['DOCUMENT_ROOT'].'/perch/runtime.php'); ?>
<?php perch_layout('global/en/top', array(
'title'=>'Activities | Conil',
'body-class'=>'activities',
)); ?>
<!--/global-top-->
<?php perch_layout('global/en/local-nav', array(
'activities-class'=>'active',
'locality'=>'conil',
'section'=>'activities',
))?>
<div>
<?php perch_content('Activity Intro');?>
</div>
<div >
<h3>ACTIVITIES</h3>
<?php perch_pages_navigation(array(
'from-path' => 'en/conil/activities',
'levels' => 1));
?>
</div>
<?php perch_layout('global/en/bottom'); ?>
I know I can create the pages manually, but I'd like to understand where am I going wrong?
I don't know if this is related but when I go to choose a template for a NEW content area I receive this notice.
P.S. Using V2.6.6
That shouldn't happen. Do you have anything other than HTML files in your template folders?
Yes Drew there was a non html file in the templates/content folder. The notice disappeared once I had deleted it. The original problem is still there, when I try to create a page from the activity master page, it is created with the wrong path and if I change the path then the page wont display? Any suggestions about fault finding appreciated. Thanks.
The new page that is created by perch contains the code
This is one level too high to find the template.
It does not include the template file name.
If I edit the code by hand to remove a level
..\
and then add in the template file nameactivity.php
Then it works as expected?
to be continued...
This is on a Windows server, is that correct?
I get the same error i.e.
Warning: include(/home/forge/www.mysite.com/public/perch/core/runtime/runtime.php): failed to open stream: No such file or directory in /home/forge/www.mysite.com/public/perch/runtime.php on line 2
and
Warning: include(): Failed opening '/home/forge/www.mysite.com/public/perch/core/runtime/runtime.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/forge/www.mysite.com/public/perch/runtime.php on line 2
My setup is a little different as this is happening with the blog add on and I'm using the blog template in a laravel app.
On my local machine I'm running Ubuntu, vagrant, laravel, and github with the blog app not modified (i.e. out of the box) with the example pages. The app runs fine except for the port which I sometimes have to add to the path. I transfer over to my live server (DigitalOcean which is synched with github) and do the necessary as explained in the docs i.e. import/export the database (just checked to make sure that both are in sync), etc and get the above error. I've tried modifying the path even to the extent of using the public_path() function in laravel and even plugging in the full server pathname. The resources folder is set and I've also tried the same with the core folder.
I was wondering if I'm 'outside the bounds' and only posted because it's the same error. I was thinking of raising this as a separate thread but saw this post.
'Outside the bounds' as in: whether this is a problem in other places (i.e. laravel) but my app with unmodified default blog template runs fine locally but not on the live server due to the above error. I'm at the point where I'm wondering if it's the latest version of php or whether it's reading the wrong index file. I also tried to add another simple perch region to another page of the site and get the same error.
The database is fine as I've another page that accesses the same database as the perch files and the rest of the site works fine. On the live server I've checked whether runtime.php is where it is expected to be and it is.
All works fine locally but raises these errors live?
I'm also using the latest version of perch: 2.6.6. - blog app downloaded last Friday.
Hope this helps to eradicate some possible areas and hopefully helps me.
Thanks Martin Rowe
No not a Windows server Drew.
It is a copy of my dev site on my Windows laptop running XAMPP. So it's an Apache server.
The path to my template seems to be wrong. The page being created lives at /en/conil/activities/new-page.php
here is a snippet from my perch generated site map.
If I leave the default path created by Perch when I create the page using the
activity
master Perch puts the path as/new-page.php
and the the page is created.The
activity
template is applied.In Perch admin the page is nested under
--activities
.The problem is that the actual page is not physically nested under
activities
at all. It is actually located at root level?Here is a snapshot from a new
activity7.php
page I just created by Perch automatically.In the Perch admin activity7 shows up as being nested under
--activities
Ok, so yes, it's on Windows. Can you show me your diagnostics report?
Here you are Drew, the short version.
Viewing Diagnostic Information. Diagnostics report HEALTH CHECK
Perch is up to date
PHP 5.4.19 is up to date
MySQL 5.5.32 is up to date
Image processing available
File upload size is low. You can only upload files up to 2M.
SUMMARY INFORMATION
Perch: 2.6.6, PHP: 5.4.19, MySQL: mysqlnd 5.0.10 - 20111026 - $Id: e707c415db32080b3752b232487a435ee0372157 $, with PDO Server OS: WINNT, apache2handler Installed apps: content (2.6.6), assets (2.6.6), categories (2.6.6), perch_events (1.9), perch_forms (1.7), perch_mailchimp (2.0.1), perch_comments (1.1), perch_members (1.0.3), perch_backup (1.2)
App runtimes: <?php $apps_list = array( 'content', 'perch_forms', 'perch_events', 'perch_mailchimp', 'perch_comments', 'perch_members', ); ?>
PERCH_LOGINPATH: /perch PERCH_PATH: C:\xampp\htdocs\sites\popp\public\perch PERCH_CORE: C:\xampp\htdocs\sites\popp\public\perch\core PERCH_RESFILEPATH: C:\xampp\htdocs\sites\popp\public\perch\resources Image manipulation: GD
PHP limits: Max upload 2M, Max POST 8M, Memory: 128M, Total max file upload: 2M
Resource folder writeable: Yes HTTP_HOST: popp.local DOCUMENT_ROOT: C:/xampp/htdocs/sites/popp/public REQUEST_URI: /perch/core/settings/diagnostics/ SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Full report