Forum

Thread tagged as: Problem, Configuration

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?

Andy Clark

Andy Clark 0 points

  • 7 years ago

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.

Array

(

    [type] => 8

    [message] => Undefined index: path

    [file] => C:\xampp\htdocs\sites\popp\public\perch\core\apps\content\modes\region.define.post.php

    [line] => 37

)

P.S. Using V2.6.6

Drew McLellan

Drew McLellan 2638 points
Perch Support

That shouldn't happen. Do you have anything other than HTML files in your template folders?

Drew McLellan said:

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


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

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 name activity.php


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

Then it works as expected?

to be continued...

Drew McLellan

Drew McLellan 2638 points
Perch Support

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

Drew McLellan said:

This is on a Windows server, is that correct?

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.


<url> <loc> https://popp-it.com/en/conil/activities/activity3.php </loc> </url> <url> <loc> https://popp-it.com/en/conil/activities/activity2.php </loc> </url>

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.

<url>
    <loc>
        https://popp-it.com/en/conil/activities/activity2.php
    </loc>
</url>
  <url>
      <loc>
        https://popp-it.com/en/conil/activities/activity5.php
    </loc>
</url>
<url>
    <loc>
        https://popp-it.com/acvtivity7.php
    </loc>
</url>

In the Perch admin activity7 shows up as being nested under --activities

Drew McLellan

Drew McLellan 2638 points
Perch Support

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

Viewing Diagnostic Information
Diagnostics report
PERCH INFORMATION

Perch: 2.6.6
Production mode: Production (100)
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)
DB driver: PDO
DB tables: perch2_categories, perch2_category_counts, perch2_category_sets, perch2_comments, perch2_comments_votes, perch2_content_index, perch2_content_items, perch2_content_regions, perch2_events, perch2_events_categories, perch2_events_to_categories, perch2_forms, perch2_forms_responses, perch2_mailchimp_campaigns, perch2_mailchimp_history, perch2_mailchimp_log, perch2_mailchimp_stats, perch2_mailchimp_subscribers, perch2_members, perch2_members_forms, perch2_members_member_tags, perch2_members_sessions, perch2_members_tags, perch2_navigation, perch2_navigation_pages, perch2_page_templates, perch2_pages, perch2_resource_log, perch2_resource_tags, perch2_resources, perch2_resources_to_tags, perch2_settings, perch2_user_privileges, perch2_user_role_privileges, perch2_user_roles, perch2_users
Users: 1
App runtimes:
<?php
    $apps_list = array(
        'content',
        'perch_forms',
        'perch_events',
        'perch_mailchimp',
        'perch_comments',
        'perch_members',
        );
?>
Scheduled tasks for perch_events: update_category_counts (60 mins)
Scheduled tasks for perch_mailchimp: update_list_stats (60 mins)
Editor plug-ins: markitup, redactor
H1: 67c84f7e89b651f2bd905bd7b1c7b1e0
L1: e390d906626092b68135d3fca83db9a0
headerColour: #ffffff
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 0
content_collapseList: 1
lang: en-gb
update_2.4.9: done
latest_version: 2.5.3
on_sale_version: 2.6.6
update_2.5.3: done
perch_events_update: 1.8
perch_mailchimp_secret: a9d16fd8a6d898b007cd01fe52b6b2b2
perch_mailchimp_update: 2.0
update_2.5.4: done
headerScheme: light
perch_backup_mysqldump_path:
perch_comments_akismet_key:
perch_events_detail_url: event.php?event={eventSlug}
perch_mailchimp_api_key:
perch_mailchimp_list_id:
perch_mailchimp_campaign_url: /mailchimp/campaign.php?s={campaignSlug}
dashboard: 0
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
update_2.6.3: done
update_2.6.6: done
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: andy
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: poppdb
PERCH_DB_PREFIX: perch2_
PERCH_TZ: Europe/Madrid
PERCH_EMAIL_FROM: info@popp-it.com
PERCH_EMAIL_FROM_NAME: popp-it
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
PERCH_RESPATH: /perch/resources
PERCH_HTML5: 1
PERCH_SCHEDULE_SECRET: jasmine
PERCH_DEBUG: 1
PERCH_RWD: 1
PERCH_RUNWAY:
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: C:\xampp\htdocs\sites\popp\public\perch\templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
HOSTING SETTINGS

PHP: 5.4.19
Zend: 2.4.0
OS: WINNT
SAPI: apache2handler
Safe mode: not detected
MySQL client: mysqlnd 5.0.10 - 20111026 - $Id: e707c415db32080b3752b232487a435ee0372157 $
MySQL server: 5.5.32
Extensions: Core, bcmath, calendar, ctype, date, ereg, filter, ftp, hash, iconv, json, mcrypt, SPL, odbc, pcre, Reflection, session, standard, mysqlnd, tokenizer, zip, zlib, libxml, dom, PDO, bz2, SimpleXML, wddx, xml, xmlreader, xmlwriter, apache2handler, openssl, curl, mbstring, exif, gd, gettext, mysql, mysqli, Phar, pdo_mysql, pdo_sqlite, soap, sockets, sqlite3, xmlrpc, xsl, mhash
GD: Yes
ImageMagick: No
PHP max upload size: 2M
PHP max form post size: 8M
PHP memory limit: 128M
Total max uploadable file size: 2M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: No
MIBDIRS: C:/xampp/php/extras/mibs
MYSQL_HOME: \xampp\mysql\bin
OPENSSL_CONF: C:/xampp/apache/bin/openssl.cnf
PHP_PEAR_SYSCONF_DIR: \xampp\php
PHPRC: \xampp\php
TMP: \xampp\tmp
HTTP_HOST: popp.local
HTTP_CONNECTION: keep-alive
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36
HTTP_REFERER: https://popp.local/perch/core/settings/diagnostics/
HTTP_ACCEPT_ENCODING: gzip,deflate,sdch
HTTP_ACCEPT_LANGUAGE: en-GB,en-US;q=0.8,en;q=0.6
HTTP_COOKIE: cmssb=0; cmsa=1; __utma=242806787.2043648022.1405502964.1412012560.1412062593.128; __utmc=242806787; __utmz=242806787.1405502964.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); PHPSESSID=sodp87g6u5nq2achuli0i397h6
PATH: C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\HashiCorp\Vagrant\bin;C:\Ruby200-x64\bin;C:\ProgramData\Drush\;C:\Program Files (x86)\Drush\GnuWin32\bin;C:\Program Files (x86)\Drush\Php;C:\Program Files (x86)\Drush\cwRsync\bin;C:\Users\Owner\AppData\Roaming\npm
SystemRoot: C:\Windows
COMSPEC: C:\Windows\system32\cmd.exe
PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.RB;.RBW
WINDIR: C:\Windows
SERVER_SIGNATURE: <address>Apache/2.4.4 (Win32) OpenSSL/0.9.8y PHP/5.4.19 Server at popp.local Port 80</address>
SERVER_SOFTWARE: Apache/2.4.4 (Win32) OpenSSL/0.9.8y PHP/5.4.19
SERVER_NAME: popp.local
SERVER_ADDR: 127.0.0.1
SERVER_PORT: 80
REMOTE_ADDR: 127.0.0.1
DOCUMENT_ROOT: C:/xampp/htdocs/sites/popp/public
REQUEST_SCHEME: http
CONTEXT_DOCUMENT_ROOT: C:/xampp/htdocs/sites/popp/public
SERVER_ADMIN: postmaster@localhost
SCRIPT_FILENAME: C:/xampp/htdocs/sites/popp/public/perch/core/settings/diagnostics/index.php
REMOTE_PORT: 54185
GATEWAY_INTERFACE: CGI/1.1
SERVER_PROTOCOL: HTTP/1.1
REQUEST_METHOD: GET
QUERY_STRING: extended
REQUEST_URI: /perch/core/settings/diagnostics/?extended
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
PHP_SELF: /perch/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1412067126.396
REQUEST_TIME: 1412067126