Welcome, Guest
Username: Password: Remember me

TOPIC: A simple variable (easy question)

A simple variable (easy question) 18 Mar 2013 03:37 #6971

  • geoffr
  • geoffr's Avatar
  • Offline
  • Senior Member
  • Posts: 68
  • Thank you received: 2
  • Karma: 0
I am not a programmer and have the simplest of questions, almost embarrassing ;-)

I have created a component with Cook, and I now wish to add a variable into the header of the component that can be displayed on the front end flysheets.

Where/how do I set up the following variable?

$myPageTitle = '<span class="title">Welcome to My Component Page</span>';

I'm fine with the fly...
<?php echo $myPageTitle ?>

thanks,
Geoff
Last Edit: 18 Mar 2013 03:38 by geoffr.
The administrator has disabled public write access.

Re: A simple variable (easy question) 22 Mar 2013 14:54 #6992

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
I'm a bit unclear as to exactly what you're looking for...

Is this a title that you want rendered no matter who installs it and on which server?
Do you want it on every page of your component?

If yes to either or both of the above & you wish to let the admin of your component add this title themselves then:
add a config parameter to your component's xml, for example, a field called component_message. Then retrieve the value of the parameter as set by the admin of your component/site and echo it to the page. How to add parameters to your component: www.j-cook.pro/forum/9-coding-inside-you...d-a-work-with-params

On the other hand, if you want a 'fixed' message for every installation of your component that can't be overridden by the admin form the configuration, declare a helper function/variable in your helper.php file OR a JDom class and echo it on every layout.

Try looking at how the page title is already added to your views/layouts for more hints.

Hope it helps!

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.
The following user(s) said Thank You: admin, geoffr
Time to create page: 0.085 seconds

Get Started