Jump to content

Call the same field on different templates


Mijo
 Share

Recommended Posts

Hello everyone,

I have a question, how to call  a field from one template  to other  template?

For example; I have a phone field on the homepage, I want to display this information on template about us?

I call that field on homepage like this:

<?php echo $page->phone; ?>

I'll try to do that on template about-us, display same information from that field (phone), but nothing happened?

Is there any easy way to do that, to show the same field in different templates?

I hope it is clear what I want to do :-)

Thanks in advance

Link to comment
Share on other sites

9 hours ago, fbg13 said:

// "/" is the home page
$home = $pages->get("/");

echo $home->phone;

 

Thank you for your answer. This option is ok, but it outputs number 1 on about-us template, like this  1+123456789 it should be +123456789, I don't know what is a problem. 

Thank you in advance. 

Link to comment
Share on other sites

44 minutes ago, Mijo said:

This option is ok, but it outputs number 1 on about-us template, like this  1+123456789

Are you sure about this? Simply outputting a field should not prepend anything to the field's value. Can you post the exact code snippet you use?

Link to comment
Share on other sites

1 hour ago, Mijo said:

Thank you for your answer. This option is ok, but it outputs number 1 on about-us template, like this  1+123456789 it should be +123456789, I don't know what is a problem. 

Make sure you're not echoing $home = $pages->get("/"); too, can't think of another reason.

  • Like 1
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...