0

I am trying to build a joomla template and would like to include an image upload option for users to upload custom images for a logo.

Currently I have this structure:

In my templateDetails.xml:

<config>
    <fields name="params">
        <fieldset name="basic">
            <field name="logofile" type="media"
                   directory="images"
                   label = "Logo"
                   description ="Choose a logo"/>
      </fieldset>
  </fields>
</config>

Then in my index.php:

// Getting params from template
$params = JFactory::getApplication()->getTemplate(true)->params;

$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$this->language = $doc->language;
$this->direction = $doc->direction;

// Detecting Active Variables
$option   = $app->input->getCmd('option', '');
$view     = $app->input->getCmd('view', '');
$layout   = $app->input->getCmd('layout', '');
$task     = $app->input->getCmd('task', '');
$itemid   = $app->input->getCmd('Itemid', '');
$sitename = $app->getCfg('sitename');
$logo = $this->params->get('logo');

Then further down in my body I try to output the $logo variable but It displays nothing on the screen....

<a  href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/<?php echo $logo;?> 

Anyone know where I might be going wrong?? Much appreciated for any help or advice.

EDIT Made some progess.

when I upload images they are being stored in the default images folder in the joomla directory. I copied the image across to my templates image folder and managed to get it to display using this:

  <img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/images/logo2.png" 

however it is not dynamic as $logo is not being used. It does not seem to be assigned any value at all.

Javacadabra
  • 5,578
  • 15
  • 84
  • 152
  • Do you mean you want uses to be able to upload an image via the frontend of the site? Or is this a template you will be providing for admins to install on their site and a feature for the backend parameters? – Lodder Mar 27 '14 at 14:39
  • sorry yes for back end so admins can choose which image to have as a logo – Javacadabra Mar 27 '14 at 14:40
  • @Lodder thanks for your patience on this issue....also thank you for deleting the answer. Needless to say I resolved my issue – Javacadabra Mar 27 '14 at 15:59

0 Answers0