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

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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By sambadave
      Hi there
      Short version of question
      Let's say I have a page in the admin that contains a field... Is it possible to output the content from that field on another page in the admin? Almost like a reference.
      Longer version of question (with example)
      A house builder with multiple (60+) developments. They want to be able to create notices/messages that can be added to one or many developments. Handy for things like regional covid lockdowns or temporary office closures due to bad weather.
      My approach for the admin editing options:
      Add each message to each development
      Pros: You edit the message on the development page in context
      Cons: Very time consuming and repetitive if the same message needs to be applied to 60+ developments
        Control all the messages from one admin page and say which development each message should be applied to
      Pros: Easier to add/remove messages to more than one development at a time. Control all messages from one place.
      Cons: Content is not added on development page, which is where typical admin users may expect to find it I went for option 2 due to flexibility, and created a page within the admin for global development notices. This contains a repeater with:
      Field for message to display Checkbox list of all developments. The user can select which ones to apply each message to It's working really well but the only thing is that if the user goes to a specific development in the admin, the relevant messages aren't displayed in context (as they aren't edited on that page and instead on the global development notices page)... which may cause confusion when a new staff member / content admin tries to edit the text but there is no field when they go to the development admin page where they expect to see it...
      Solution???
      I don't require the message(s) to also be editable on the development page, but I wondered if there was a nice way to show it/them somehow. I feel like I am missing something really simple as I'm sure ProcessWire will have a nice way of achieving this, or maybe there are field settings that allow this kind of thing to happen?
      Any ideas on approaches or similar experiences would be much appreciated, even if it is just a much simpler example with the content from one field being shown on another admin page to get the ball rolling.
      Thanks in advance for any advice :)
    • By daniel_puehringer
      Hi community, thanks for the great work you do 🙂

      I´m looking for a global field which can be used in the footer and has only one instance for all pages. So I´m kind of looking for "One field to rule them all".
       
      Reason for my question: The website I´m currently building has one footer for all pages. The content of the footer should be dynamic - therefore I made a global field which is automatically inserted into each page.
      Problem: if I want to change something in the footer, I have to do it for all fields, because each field has it´s own instance.

      Question: is it possible to have one global field in which changes the content for the footer of all pages?

      In most CMS Systems a simple solution to this is often impossible, I hope that processwire is different 🙂

      All the best,
      Daniel
       
    • By Pip
      Hi, Everyone! 
      I'm currently working on a page reference field and set it for multiple pages (AsmSelect) for the input. Is there a way for me to add an image field (aka Avatar) and the title of page in the radio button? 
      I used the field name enclosed in the { }. Didn't work. It appeared a text instead. 
      Thanks in advance and hope to hear from you soon!
    • By EyeDentify
      Hello dear PW gurus.

      I have stumbled over a strange error that i all of sudden got when trying to upload an image to a images field on a page.
      There where images allready stored in the field that i wanted to keep, but during the upload the error apear and after that all images are gone from the field and i can´t upload any, i just get the error every time.
      I am running ProcessWire 3.0.153 dev.
      Update:
      After looking in the assets folder i find the folder for the page and the image files seems to be there including the ones i tried to upload when the error occured.
      But they don´t show up in the images field in the page editor.
       
      The error reported:
       
      SQLSTATE[01000]: Warning: 1265 Data truncated for column 'ratio' at row 1 And here is a screenshot of the event:

      The TracyDebugger Error reporting:

      I hope you fine folks could point me in a direction.
      But it seems our old pal set_time_limit() is back.

      Regards, EyeDentify
    • By DV-JF
      Hey all, hope you're feeling well these days!
      Short question: Under "Setup > Templates" it's possible to sort the templates by last modified. Is this possible for fields view to?
      Long explanation:
      Currently I am in the process of programming a reusable template and often have to copy several fields & templates from different PW installations into my "master version".
      Therefore it would be good to see already in the field list when the last modification has taken place.
      Stay healthy & don't forget to wash you hands - many greets!
×
×
  • Create New...