Jump to content

[SOLVED] Header field displays content strangely


joeck
 Share

Recommended Posts

Hello everyone,

My Website works just fine beside the one field which behaves strangely and I can't figure out why.

I have a template called "main-subpage" which I use for most subpages. All of them have a header and on every other Page it works just fine.

But on the one page it displays the first few letters random and sometimes the last ones corectly, sometimes the last ones are wrong as well. What iritates me is that this is only on the one Page and all the other pages with the same template don't have that issue. The rest of the page is displayed just fine.

I tried different content in the field but it doesnt seem to help anything.

 

Code in the template:

<h1>
  <?php echo $page->header | $page->title; ?>
</h1>

on the page it should display: "Das Konzept des ZiSMed" but what I see is (attachement):

 

Thank you for your help!

display.tiff

Link to comment
Share on other sites

25 minutes ago, Macrura said:

Did you mean this?


<h1> <?=page->header . ' | ' . $page->title?> </h1>

 

No I don't think so. The code I have should display a the page header if there is one. If not it should take the title as a "backup". So the title should only be displayed if header is empty/not set. Im not entirely sure if the syntax is correct but it works for all other sites with the same template...

Just the one mentioned above is a bit...moody.

 

I assume your version displays something like "<header> | <title>" which is not what I want...

Link to comment
Share on other sites

And with, for example:

$title = $page->get('header|title');     [ in _init.php ]

and

<h1><?php echo $title; ?></h1>     [ in you template file ]

?

(See the default profiles coming with a ProcessWire download before the installation process.)

Edited by Christophe
Removed the second part
  • Like 1
Link to comment
Share on other sites

2 minutes ago, Christophe said:

And with, for example:

$title = $page->get('header|title');     [ in _init.php ]

and

<h1><?php echo $title; ?></h1>     [ in you template file ]

?

(See the default profiles coming with a ProcessWire download before the installation process.)

Or directly:

$page->get('header|title');     [ in your template file ]

?

thank you as well, in the end its the same as Zeka said.

Thank you!

Link to comment
Share on other sites

  • joeck changed the title to [SOLVED] Header field displays content strangely

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...