views:

398

answers:

0

I'm creating a custom template, and i have added a parameter 'headerpic' to various views.

<param name="headerpic" type="filelist" default="" label="Header Image" description="Select the image for the header" directory="images/headers" filter="\.jpg" />

The client can then change the header image for each page from a drop down list. In the template i can get the value like so

<?php
  $params = &JComponentHelper::getParams( 'com_content' );
  $params->get( 'headerpic' );
  // e.g. for the com_weblinks component, you would use:
  // $params = &JComponentHelper::getParams( 'com_weblinks' )
?>

My questions:

  1. How can I get the parameter value from whatever component is currently active? For example on the guest book page the value is stored to com_guestbook etc.
  2. Is there a way I can add the custom parameter to any and every menu link? That way I don't have to add it to every component.

EDIT: I found the solution for Q1:

$component = JRequest::getVar('option');