Wish List

Ask for help or provide support to other members.
User avatar
NorfolkGreg
Posts: 150
Joined: Wed Sep 01, 2021 7:50 am

Re: Wish List

Post by NorfolkGreg »

There's no error_log appeared.
User avatar
wiz
Posts: 785
Joined: Sat Oct 30, 2010 12:23 am

Re: Wish List

Post by wiz »

Thank you Greg, great initial news.
User avatar
NorfolkGreg
Posts: 150
Joined: Wed Sep 01, 2021 7:50 am

Re: Wish List

Post by NorfolkGreg »

I'm wondering about how best to proceed with the upgrade to the GregCustom theme to cope with v3.5.0.

The GregCustom theme.php file currently includes the following, which grossly misuses items that should only be found in <head> tags:

Code: Select all

<header>
  <h1>
    <em><?= $Wcms->get('config', 'siteTitle') ?></em><br>
      <?= $Wcms->page('title') ?>
    </h1>
    <h2><?= $Wcms->page('description') ?></h2>
</header>
I take it I simply replace that with this?

Code: Select all

<header>
  <?= $Wcms->header() ?>
</header>
and provide, in the README.md file, an upgrade section with sample code to replicate the original that they will need insert to replace the default contents provided in the v3.5.0 index.php file?

I'm still to play with the new search feature! No doubt there'll be questions! :)
User avatar
NorfolkGreg
Posts: 150
Joined: Wed Sep 01, 2021 7:50 am

Re: Wish List

Post by NorfolkGreg »

Well, I've tried the approach above. I've replaced the index.php file with the 3.5.0 version. My theme.php file's <header> tags now contain:

Code: Select all

<header>
	<?= $Wcms->header() ?>
<!--
	<h1>
		<em><?= $Wcms->get('config', 'siteTitle') ?></em><br>
		<?= $Wcms->page('title') ?>
	</h1>
	<h2><?= $Wcms->page('description') ?></h2>
-->
</header>
but nothing appears! Obviously I expected my original, now commented, code to disappear, but looking through the 3.5.0 index file I was expecting to see the following text instead:

Code: Select all

You can include this in your theme.php and edit it.
styled according to my <nav> styling rules.

I guess it's something that I've failed to do thanks to my ignorance of PHP code.
User avatar
wiz
Posts: 785
Joined: Sat Oct 30, 2010 12:23 am

Re: Wish List

Post by wiz »

Hi Greg.

The PHP tag you should be calling is

Code: Select all

<?= $Wcms->header() ?>
, it seems you are using the correct one.

I tested this and this appeared:

Code: Select all

<nav>You can include this in your theme.php and edit it.</nav>
Please try this and let me know if it works for you and also check if there was any error_log generated if nothing appears.
User avatar
NorfolkGreg
Posts: 150
Joined: Wed Sep 01, 2021 7:50 am

Re: Wish List

Post by NorfolkGreg »

Is there something else I need to make it work other than to replace the v3.4.3 version of the index.php file with the v3.5.0 version?
User avatar
wiz
Posts: 785
Joined: Sat Oct 30, 2010 12:23 am

Re: Wish List

Post by wiz »

Nope, it's the only file that had any changes related to this.

1. What happens if you just put the tag anywhere, without commenting out any other code?
2. Also make sure you have the 3.5.0 index.php: https://raw.githubusercontent.com/Wonde ... /index.php
3. I will try installing your theme and giving this a go.
Update From point 3, I can confirm this works just by adding the tag, or using it as you specified earlier.

Also, if you want to comment out PHP that is in HTML, you have to comment it out seperately:

Code: Select all

<header>
	<?= $Wcms->header() ?>
<!--
	<h1>
		<em><?= //$Wcms->get('config', 'siteTitle') ?></em><br>
		<?= //$Wcms->page('title') ?>
	</h1>
	<h2><?= //$Wcms->page('description') ?></h2>
-->
</header>
User avatar
wiz
Posts: 785
Joined: Sat Oct 30, 2010 12:23 am

Re: Wish List

Post by wiz »

Maybe you want to achieve this?

By calling

Code: Select all

<?= $Wcms->header() ?>
to include the below in your theme?

Code: Select all

<header>
	<h1>
		<em><?= $Wcms->get('config', 'siteTitle') ?></em><br>
		<?= $Wcms->page('title') ?>
	</h1>
	<h2><?= $Wcms->page('description') ?></h2>
</header>

Easiest way to achieve this is:
1. In your theme folder, create functions.php file, which looks like this:

Code: Select all

<?php
    global $Wcms;
    $Wcms->addListener('header', 'customHeaderOutput');
    
    function customHeaderOutput($args) {
        global $Wcms;
        $content = '<header>
            <h1>
                <em>'. $Wcms->get('config', 'siteTitle') .'</em><br>
                '. $Wcms->page('title') .'
            </h1>
            <h2>'. $Wcms->page('description') .'</h2>
        </header>';
        $args[0] = $content;
        return $args;
    }
?>
2. This will use the header hook, to modify it. So, calling

Code: Select all

<?= $Wcms->header() ?>
in your theme will now output

Code: Select all

<header>
	<h1>
		<em><?= $Wcms->get('config', 'siteTitle') ?></em><br>
		<?= $Wcms->page('title') ?>
	</h1>
	<h2><?= $Wcms->page('description') ?></h2>
</header>
3. Don't forget to put

Code: Select all

<?= $Wcms->header() ?>
in your theme.
4. Don't forget to remove the old header code from the theme.php, which is now unnecessary since you call it from the functions.php file.
5. Tested this and it works.
User avatar
NorfolkGreg
Posts: 150
Joined: Wed Sep 01, 2021 7:50 am

Re: Wish List

Post by NorfolkGreg »

wiz wrote: Fri Mar 14, 2025 8:58 pm Nope, it's the only file that had any changes related to this.

1. What happens if you just put the tag anywhere, without commenting out any other code?
2. Also make sure you have the 3.5.0 index.php: https://raw.githubusercontent.com/Wonde ... /index.php
I think there might have been an issue with caching in my earlier report. Certainly, things were a little different when I tried this morning. Perhaps I never attempted to login!

Initially, my theme's <header> code was as before (i.e. with the call to the header and the old commented code)

The site displayed with no header and the main navigation menu (which, in my theme, is between the <header> and <section id="main"> blocks) displaying at the top of the page.

Then I logged in. Now an empty editable block displays above the navigation menu. That prompted me to edit my theme to remove the commented code so it now looks like this:

Code: Select all

	<header>
		<?= $Wcms->header() ?>
	</header>
With the revised theme uploaded there was still no header displayed. I logged in and put some test code in the empty editable block that then appeared. Once saved it displayed as expected with all the header styling of the theme. So it looks as if we are 90% of the way there.

The one query that is left is why, throughout my tests, I do not see displayed the code:

Code: Select all

<nav>You can include this in your theme.php and edit it.</nav>
which I assume is intended to appear in in the invisible empty header block that only appears after I login.

I wonder if there are some assumptions in your code that means it never gets displayed if there are <header> tags already in place in the theme file?
User avatar
wiz
Posts: 785
Joined: Sat Oct 30, 2010 12:23 am

Re: Wish List

Post by wiz »

There are no statements or assumptions that the header would not be displayed.
I tried a fresh install and an updated one with 3.5.0 and the above worked for me.

This sounds like you might have a mistake somewhere in your code when you were making changes.


1. Make sure you don't have anything weird commented out.
2. If you can, follow the above instructions with creating a functions.php file, to see if there will be any difference.
3. This one is important: can you check your database.js and see if you have a "header" section?
Post Reply