Jump to content
joeck

[SOLVED] Header field displays content strangely

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

Share this post


Link to post
Share on other sites

Did you mean this?

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

 

Share this post


Link to post
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...

Share this post


Link to post
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

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

If you don't want to call a method, or want to use it in a string, you can use $page->header_OR_title too.

echo "Text: $page->headline_OR_title"

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Mithlesh
      Hi, I have one URL - writerrelocations.com/contact-now/

      I have one issue where my header Image is appearing again after the contact form, for your reference:



      I have checked my processwire template section where have not added any Image field besides Header Image, attaching the same for the reference:




      PLEASE help me to get rid of the image below contact form

      Waiting for the swift response!

      Thanks
       
    • By Macaco
      Hi there, 
      I have two templates that should talk to each other. One is for events which should access a list of artists (eventually add a new artist) and their images related to that event; the second is the artist page, which the user should be able to add or remove events that they participated, also mentioning which images are related to each event.
      Some sort of feedback loop between the two.
      I have tried searching around the community and google, but maybe I'm not formulating the question properly. 
      Thank you all for the amazing work with Processwire and the community support. I have made a few websites with PCW yet I'm still quite between beginner and intermediate.
    • By Robin S
      Thanks to @Macrura for the idea behind this module.
      Page Field Info
      Adds information about options in Page Reference fields. Supports InputfieldSelect and inputfields that extend InputfieldSelect:
      InputfieldSelect InputfieldRadios InputfieldSelectMultiple InputfieldCheckboxes InputfieldAsmSelect Requires ProcessWire >= 3.0.61 and AdminThemeUikit.
      Screenshots
      Field config

      Example of changes to inputfield

      Example of info field filled out in Page Edit

      Installation
      Install the Page Field Info module.
      Configuration
      In the Input tab of the settings for a Page Reference field...
      Tick the "Add info tooltips to options" checkbox to enable tooltips for the options in the field. Tooltips are not possible for Select or AsmSelect inputfield types so for those types you would want to tick the next option. Tick the "Append info about selected options" checkbox to append information about the selected options to the bottom of the inputfield. If the Page Reference field is a "multiple pages" field then the info for each selected option will be prefixed with the option label (so the user will know what option each line of info relates to). In the "Info field" dropdown select a text field that will contain information about the page, to be used in the tooltips and appended info. Of course this field should be in the template(s) of the selectable pages for the Page Reference field. Hook
      In most cases the "Info field" will supply the text for the tooltips and appended info, but for advanced usages you can hookPageFieldInfo::getPageInfo() to return the text. For example:
      $wire->addHookAfter('PageFieldInfo::getPageInfo', function(HookEvent $event) { $page = $event->arguments(0); // The page $inputfield = $event->arguments(1); // InputfieldPage $field = $event->arguments(2); // The Page Reference field $info = $event->return; // Text from the info field, if any // Set some custom text as the $event->return... });  
      https://github.com/Toutouwai/PageFieldInfo
      https://modules.processwire.com/modules/page-field-info/
    • By gregory
      Hi guys. I need to create a field (link field) that allows me to select the internal pages to use as links. Do you have any suggestions? Thank you.
×
×
  • Create New...