Forum

Thread tagged as: Question, Problem, Error

head tag not working

Perch: 2.8.13, PHP: 5.6.13, MySQL: 5.5.32, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (2.8.13), assets (2.8.13), categories (2.8.13), perch_blog (4.6), perch_forms (1.8.3)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_forms', 'perch_blog', );
PERCH_LOGINPATH: /admin
PERCH_PATH: /home/intakeve/public_html/admin
PERCH_CORE: /home/intakeve/public_html/admin/core
PERCH_RESFILEPATH: /home/intakeve/public_html/admin/resources
Image manipulation: GD
PHP limits: Max upload 128M, Max POST 128M, Memory: 256M, Total max file upload: 128M
Resource folder writeable: Yes
HTTP_HOST: www.intakevets.co.uk
DOCUMENT_ROOT: /home/intakeve/public_html
REQUEST_URI: /admin/core/settings/diagnostics/
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php

I'm trying to add a title tag in the global.header.php I've tried this: <title><?php perch_layout_var('title'); ?></title> which returns an empty title tag on all pages I've tried this: <title><?php perch_pages_title(); ?></title> which returns the page title on 2 pages https://www.intakevets.co.uk/ & https://www.intakevets.co.uk/contact.php all other pages return an empty title tag, all pages include global.header.php

Raicheal Gallagher

Raicheal Gallagher 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

For which pages does perch_pages_title() return nothing?

Do those pages appear in your Pages list in the Perch control panel? Do they have titles set?

Nothing is returned for all other pages on the site. eg: https://www.intakevets.co.uk/equine/ This page is in the pages list and has a title set (as do all the pages on the site).

The two pages that work have .php added to their path, all other pages do not, if I manually add .php to the path eg: equine.php it works. This means I have to manually adjust all the system generated paths - is this normal? When adding a page I see a note telling me the file extension will be added automatically - but it hasn't been added??

But now the system menu is adding the .php suffix to all system generated urls.

Drew McLellan

Drew McLellan 2638 points
Perch Support

What steps are you going through to add a new page?

More strangeness.

  1. if I have a page with the path "equine.php" the title works and the url is /equine.php

  2. If then add a page with the path "equine" both pages work

  3. If I rename the path equine.php to something else the page with the path "equine" shows the page but not the title tag.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You shouldn't add a page with the path equine, unless you're using the "this page will have more pages below it" option (which creates a folder with an index page.

All the pages were existing .html pages that were renamed .php After they were renamed we added them as pages 1. Click the add page button. 2. Add the page title, hit tab to add the navigation title and the path 3. Click Submit That's it

Drew McLellan

Drew McLellan 2638 points
Perch Support

Did you select "This page already exists"?

yes that is selected by default.

Drew McLellan

Drew McLellan 2638 points
Perch Support

So at what point do you end up with a path of equine ?

If I add the "page title" field as equine then hit tab the word equine is added to the fields "navigation text" and "filename" so all three say equine, if I then hit submit all is good. If I then go back into the entry and view "page options" the "path" field is "/equine " , no suffix is visible (I assumed this was correct - but I guess it isn't and should be "equine.php"?). The path /"equine" appears as expected in the menu and works to view the page but other things (like this issue) don't.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ah, ok, if you're adding a page that already exists then you'll need to enter the full, correct path.

This isn't something you'd routinely need to do - pages are added automatically when you add content regions to them.

Thanks, now all is clear. I think this really tiny misunderstanding has caused us no end of problems.