Titles, Meta Description, Meta Keywords

Phoca Download - download manager
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48595
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Titles, Meta Description, Meta Keywords

Post by Jan »

Hi, thank you for the guide.

Jan
If you find Phoca extensions useful, please support the project
Earthson
Phoca Member
Phoca Member
Posts: 36
Joined: 01 Oct 2008, 15:37
Contact:

Re: Titles, Meta Description, Meta Keywords

Post by Earthson »

Hey buzubuzi,

I looked at components\com_phocadownload\views\category\view.html.php , but I don't have the code you have. I'm running on Joomla 1.7...not sure if you are on 1.5 and the code is different.

Here is the code in my file...can you help me out with the necessary changes? Thanks a million! :twisted:

Code: Select all

<?php
/*
 * @package Joomla 1.5
 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 *
 * @component Phoca Component
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');

class PhocaDownloadViewCategory extends JView
{

	protected $category;
	protected $subcategories;
	protected $files;
	
	function display($tpl = null) {		
		
		jimport( 'joomla.filesystem.folder' ); 
		jimport( 'joomla.filesystem.file' );
		$app				= JFactory::getApplication();
		$params 			= $app->getParams();
		$tmpl				= array();
		$tmpl['user'] 		= &JFactory::getUser();
		$uri 				= &JFactory::getURI();
		$model				= &$this->getModel();
		$document			= &JFactory::getDocument();
		$this->categoryId	= JRequest::getVar( 'id', 0, '', 'int' );
		$this->tagId		= JRequest::getVar( 'tagid', 0, '', 'int' );
		$limitStart			= JRequest::getVar( 'limitstart', 0, '', 'int' );
		
		$this->category		= $model->getCategory($this->categoryId);
		$this->subcategories= $model->getSubcategories($this->categoryId);
		$this->files		= $model->getFileList($this->categoryId, $this->tagId);
		$tmpl['pagination']	= $model->getPagination($this->categoryId, $this->tagId);

		
		// Limit start
		if ($limitStart > 0 ) {
			$tmpl['limitstarturl'] =  '&start='.$limitStart;
		} else {
			$tmpl['limitstarturl'] = '';
		}
		
		
		// Theme
		$theme		= $params->get( 'theme', 'phocadownload-grey' );
		JHTML::stylesheet('components/com_phocadownload/assets/phocadownload.css' );
		JHTML::stylesheet('components/com_phocadownload/assets/'.$theme.'.css' );
		JHTML::stylesheet('components/com_phocadownload/assets/phocadownloadbutton.css' );
		$buttonS	= $params->get( 'button_style', 'rc' );
		if ($buttonS == 'rc') {
			JHTML::stylesheet('components/com_phocadownload/assets/phocadownloadbuttonrc.css' );
		}
		JHTML::stylesheet('components/com_phocadownload/assets/phocadownloadrating.css' );
		$document->addCustomTag('<script type="text/javascript" src="'.JURI::root().'components/com_phocadownload/assets/overlib/overlib_mini.js"></script>');
		JHTML::stylesheet('components/com_phocadownload/assets/custom.css' );
		
		
		
		// PARAMS
		$tmpl['download_external_link'] = $params->get( 'download_external_link', '_self' );
		$tmpl['filename_or_name'] 		= $params->get( 'filename_or_name', 'filenametitle' );
		$tmpl['display_downloads'] 		= $params->get( 'display_downloads', 0 );
		$tmpl['display_description'] 	= $params->get( 'display_description', 3 );
		$tmpl['display_detail'] 		= $params->get( 'display_detail', 1 );
		$tmpl['display_play'] 			= $params->get( 'display_play', 0 );
		$tmpl['playerwidth']			= $params->get( 'player_width', 328 ); 
		$tmpl['playerheight']			= $params->get( 'player_height', 200 );
		$tmpl['playermp3height']		= $params->get( 'player_mp3_height', 30 );
		$tmpl['previewwidth']			= $params->get( 'preview_width', 640 ); 
		$tmpl['previewheight']			= $params->get( 'preview_height', 480 );
		$tmpl['display_preview'] 		= $params->get( 'display_preview', 0 );
		$tmpl['play_popup_window'] 		= $params->get( 'play_popup_window', 0 );
		$tmpl['preview_popup_window'] 	= $params->get( 'preview_popup_window', 0 );
		$tmpl['file_icon_size'] 		= $params->get( 'file_icon_size', 16 );
		$tmpl['displaynew']				= $params->get( 'display_new', 0 );
		$tmpl['displayhot']				= $params->get( 'display_hot', 0 );
		$tmpl['display_up_icon'] 		= $params->get( 'display_up_icon', 1 );
		$tmpl['allowed_file_types']		= $params->get( 'allowed_file_types', '' );
		$tmpl['disallowed_file_types']	= $params->get( 'disallowed_file_types', '' );
		$tmpl['enable_user_statistics']	= $params->get( 'enable_user_statistics', 1 );
		$tmpl['display_category_comments']= $params->get( 'display_category_comments', 0 );
		$tmpl['display_date_type'] 		= $params->get( 'display_date_type', 0 );
		$tmpl['display_file_view']		= $params->get('display_file_view', 0);
		$tmpl['download_metakey'] 		= $params->get( 'download_metakey', '' );
		$tmpl['download_metadesc'] 		= $params->get( 'download_metadesc', '' );
		$tmpl['display_rating_file'] 	= $params->get( 'display_rating_file', 0 );
		$tmpl['display_mirror_links'] 	= $params->get( 'display_mirror_links', 0 );
		$tmpl['display_report_link'] 	= $params->get( 'display_report_link', 0 );
		$tmpl['send_mail_download'] 	= $params->get( 'send_mail_download', 0 );// not boolean but id of user
		//$tmpl['send_mail_upload'] 		= $params->get( 'send_mail_upload', 0 );
		$tmpl['display_tags_links'] 	= $params->get( 'display_tags_links', 0 );
		$tmpl['display_specific_layout']= $params->get( 'display_specific_layout', 0 );
		$tmpl['info']					= PhocaDownloadHelper::renderPhocaDownload();
		// Facebook Comments
		$tmpl['fb_comment_app_id']		= $params->get( 'fb_comment_app_id', '' );
		$tmpl['fb_comment_width']		= $params->get( 'fb_comment_width', '550' );
		$tmpl['fb_comment_lang'] 		= $params->get( 'fb_comment_lang', 'en_US' );
		$tmpl['fb_comment_count'] 		= $params->get( 'fb_comment_count', '' );
		
		// RATING
		if ($tmpl['display_rating_file'] == 1 || $tmpl['display_rating_file'] == 3) {
			JHTML::_('behavior.framework', true);
			PhocaDownloadRateHelper::renderRateFileJS(1);
			$tmpl['display_rating_file'] = 1;
		} else {
			$tmpl['display_rating_file'] = 0;
		}
		


		// DOWNLOAD
		// - - - - - - - - - - - - - - - 
		$download	= JRequest::getVar( 'download', array(0), 'get', 'array' );
		$downloadId	= (int) $download[0];
		
		if ($downloadId > 0) {

			
			if (isset($this->category[0]->id) && (int)$this->category[0]->id > 0 ) {
				$currentLink	= 'index.php?option=com_phocadownload&view=category&id='.$this->category[0]->id.':'.$this->category[0]->alias.$tmpl['limitstarturl'] . '&Itemid='. JRequest::getVar('Itemid', 0, '', 'int');
			} else {
				$currentLink = $uri;
			}
			
			$fileData		= PhocaDownloadHelperFront::getDownloadData($downloadId, $currentLink);			
			PhocaDownloadHelperFront::download($fileData, $downloadId, $currentLink);
			
		}
		// - - - - - - - - - - - - - - - 
		
		// DETAIL
		// - - - - - - - - - - - - - - -
		if ($tmpl['display_detail'] == 2) {
			$buttonD = new JObject();
			$buttonD->set('methodname', 'modal-button');
			$buttonD->set('name', 'detail');
			$buttonD->set('modal', true);
			$buttonD->set('options', "{handler: 'iframe', size: {x: 600, y: 500}, overlayOpacity: 0.7, classWindow: 'phocadownloaddetailwindow', classOverlay: 'phocadownloaddetailoverlay'}");
		}
		
		JHTML::_('behavior.modal', 'a.pd-modal-button');
		// PLAY - - - - - - - - - - - -
		$windowWidthPl 		= (int)$tmpl['playerwidth'] + 50;
		$windowHeightPl 	= (int)$tmpl['playerheight'] + 50;
		$windowHeightPlMP3 	= (int)$tmpl['playermp3height'] + 50;
		if ($tmpl['play_popup_window'] == 1) {
			$buttonPl = new JObject();
			$buttonPl->set('methodname', 'js-button');
			$buttonPl->set('options', "window.open(this.href,'win2','width=".$windowWidthPl.",height=".$windowHeightPl.",scrollbars=yes,menubar=no,resizable=yes'); return false;");
			$buttonPl->set('optionsmp3', "window.open(this.href,'win2','width=".$windowWidthPl.",height=".$windowHeightPlMP3.",scrollbars=yes,menubar=no,resizable=yes'); return false;");
		} else {
			$document->addCustomTag( "<style type=\"text/css\"> \n"  
		." #sbox-window.phocadownloadplaywindow   {background-color:#fff;padding:2px} \n"
		." #sbox-overlay.phocadownloadplayoverlay  {background-color:#000;} \n"			
		." </style> \n");
			$buttonPl = new JObject();
			$buttonPl->set('name', 'image');
			$buttonPl->set('modal', true);
			$buttonPl->set('methodname', 'modal-button');
			$buttonPl->set('options', "{handler: 'iframe', size: {x: ".$windowWidthPl.", y: ".$windowHeightPl."}, overlayOpacity: 0.7, classWindow: 'phocadownloadplaywindow', classOverlay: 'phocadownloadplayoverlay'}");
			$buttonPl->set('optionsmp3', "{handler: 'iframe', size: {x: ".$windowWidthPl.", y: ".$windowHeightPlMP3."}, overlayOpacity: 0.7, classWindow: 'phocadownloadplaywindow', classOverlay: 'phocadownloadplayoverlay'}");
		}
		// - - - - - - - - - - - - - - -
		// PREVIEW - - - - - - - - - - - -
		$windowWidthPr 	= (int)$tmpl['previewwidth'] + 20;
		$windowHeightPr = (int)$tmpl['previewheight'] + 20;
		if ($tmpl['preview_popup_window'] == 1) {
			$buttonPr = new JObject();
			$buttonPr->set('methodname', 'js-button');
			$buttonPr->set('options', "window.open(this.href,'win2','width=".$windowWidthPr.",height=".$windowHeightPr.",scrollbars=yes,menubar=no,resizable=yes'); return false;");
		} else {
			$document->addCustomTag( "<style type=\"text/css\"> \n"  
		." #sbox-window.phocadownloadpreviewwindow   {background-color:#fff;padding:2px} \n"
		." #sbox-overlay.phocadownloadpreviewoverlay  {background-color:#000;} \n"			
		." </style> \n");
			$buttonPr = new JObject();
			$buttonPr->set('name', 'image');
			$buttonPr->set('modal', true);
			$buttonPr->set('methodname', 'modal-button');
			$buttonPr->set('options', "{handler: 'iframe', size: {x: ".$windowWidthPr.", y: ".$windowHeightPr."}, overlayOpacity: 0.7, classWindow: 'phocadownloadpreviewwindow', classOverlay: 'phocadownloadpreviewoverlay'}");
			$buttonPr->set('optionsimg', "{handler: 'image', size: {x: 200, y: 150}, overlayOpacity: 0.7, classWindow: 'phocadownloadpreviewwindow', classOverlay: 'phocadownloadpreviewoverlay'}");
		}
		// - - - - - - - - - - - - - - -
		
		$imagePath		= PhocaDownloadHelper::getPathSet('icon');
		$cssImagePath	= str_replace ( '../', JURI::base(true).'/', $imagePath['orig_rel_ds']);
		$filePath		= PhocaDownloadHelper::getPathSet('file');

		$tmpl['action']	= $uri->toString();
			
		$this->assignRef('tmpl',			$tmpl);
		$this->assignRef('params',			$params);
		$this->assignRef('cssimagepath',	$cssImagePath);
		$this->assignRef('absfilepath',		$filePath['orig_abs_ds']);
		$this->assignRef('buttonpl',			$buttonPl);
		$this->assignRef('buttonpr',			$buttonPr);
		$this->assignRef('buttond',			$buttonD);

		if (isset($this->category[0]) && is_object($this->category[0])){
			$this->_prepareDocument($this->category[0]);
		}

		parent::display($tpl);
		
	}
	
	protected function _prepareDocument($category) {
		
		$app		= JFactory::getApplication();
		$menus		= $app->getMenu();
		$pathway 	= $app->getPathway();
		//$this->params		= &$app->getParams();
		$title 		= null;
		
		$this->tmpl['downloadmetakey'] 		= $this->params->get( 'download_metakey', '' );
		$this->tmpl['downloadmetadesc'] 	= $this->params->get( 'download_metadesc', '' );
		

		$menu = $menus->getActive();
		if ($menu) {
			$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
		} else {
			$this->params->def('page_heading', JText::_('JGLOBAL_ARTICLES'));
		}

		$title = $this->params->get('page_title', '');
		
		if (empty($title) || (isset($title) && $title == '')) {
			$title = $this->item->title;
		}
		
		if (empty($title) || (isset($title) && $title == '')) {
			$title = htmlspecialchars_decode($app->getCfg('sitename'));
		} else if ($app->getCfg('sitename_pagetitles', 0)) {
			$title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->getCfg('sitename')), $title);
		}
		//$this->document->setTitle($title);

		
		$this->document->setTitle($title);
		
		if ($category->metadesc != '') {
			$this->document->setDescription($category->metadesc);
		} else if ($this->tmpl['downloadmetadesc'] != '') {
			$this->document->setDescription($this->tmpl['downloadmetadesc']);
		} else if ($this->params->get('menu-meta_description', '')) {
			$this->document->setDescription($this->params->get('menu-meta_description', ''));
		} 

		if ($category->metakey != '') {
			$this->document->setMetadata('keywords', $category->metakey);
		} else if ($this->tmpl['downloadmetakey'] != '') {
			$this->document->setMetadata('keywords', $this->tmpl['downloadmetakey']);
		} else if ($this->params->get('menu-meta_keywords', '')) {
			$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords', ''));
		}

		if ($app->getCfg('MetaTitle') == '1' && $this->params->get('menupage_title', '')) {
			$this->document->setMetaData('title', $this->params->get('page_title', ''));
		}
		
		// Breadcrumbs TODO (Add the whole tree)
		/*$pathway 		= $app->getPathway();
		if (isset($this->category[0]->parentid)) {
			if ($this->category[0]->parentid == 0) {
				// $pathway->addItem( JText::_('COM_PHOCADOWNLOAD_CATEGORIES'), JRoute::_(PhocaDownloadHelperRoute::getCategoriesRoute()));
			} else if ($this->category[0]->parentid > 0) {
				$pathway->addItem($this->category[0]->parenttitle, JRoute::_(PhocaDownloadHelperRoute::getCategoryRoute($this->category[0]->parentid, $this->category[0]->parentalias)));
			}
		}

		if (!empty($this->category[0]->title)) {
			$pathway->addItem($this->category[0]->title);
		}*/
		
		// Breadcrumbs TODO (Add the whole tree)
		$pathway 		= $app->getPathway();
		if (isset($this->category[0]->parentid)) {
			if ($this->category[0]->parentid == 0) {
				// $pathway->addItem( JText::_('COM_PHOCADOWNLOAD_CATEGORIES'), JRoute::_(PhocaDownloadHelperRoute::getCategoriesRoute()));
			} else if ($this->category[0]->parentid > 0) {
				$curpath = $pathway->getPathwayNames();
				if($this->category[0]->parenttitle != $curpath[count($curpath)-1]){
				 	$pathway->addItem($this->category[0]->parenttitle, JRoute::_(PhocaDownloadHelperRoute::getCategoryRoute($this->category[0]->parentid, $this->category[0]->parentalias)));
				}
			}
		}

		if (!empty($this->category[0]->title)) {
			$curpath = $pathway->getPathwayNames();
			if($this->category[0]->title != $curpath[count($curpath)-1]){
				$pathway->addItem($this->category[0]->title);
			}
		}

	}
}
?>
Earthson
Phoca Member
Phoca Member
Posts: 36
Joined: 01 Oct 2008, 15:37
Contact:

Re: Titles, Meta Description, Meta Keywords

Post by Earthson »

Ok, it seems like I worked it out myself.

I didn't have some of the code you mentioned in your post. This is what was missing:

Code: Select all

 
      if (empty($title)) {
         $title = $this->item->title;
      }
      $this->document->setTitle($this->category[0]->title);
I just had this code:

Code: Select all

$this->document->setTitle($title);
So, I simply added the extra code to my file, to make:

Code: Select all

$this->document->setTitle($title);
      
      if (empty($title)) {
            $title = $this->item->title;
      }
      $this->document->setTitle($this->category[0]->title);
and that seems to work. Category names are showing up as page title.

Thank you for the code!
SonRiab
Phoca Professional
Phoca Professional
Posts: 258
Joined: 02 Jun 2011, 09:29
Contact:

Re: Titles, Meta Description, Meta Keywords

Post by SonRiab »

ATTENTION
This post relates to Phoca Download Version 2.1.4!
This could also work for older versions but I haven't tested it!

BEFORE CHANGING ANY FILE MAKE SURE YOU HAVE A BACKUP OF THEM!

A little improvement to the code Earthson posted:

Code: Select all

		// get page title
		$title = $this->params->get('page_title', '');
		// if no page title is set take the category title only
		if (empty($title)) {
			$title = $this->category[0]->title;
		}
		// else append the category title
		else {
			 $title .= " - " . $this->category[0]->title;
		}
		// if still is no title is set take the sitename only
		if (empty($title)) {
			$title = $app->getCfg('sitename');
		}
		// else add the title before or after the sitename
		elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
			$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
		}
		elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
			$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
		}
		$this->document->setTitle($title);
This code is more robust because it makes sure the title is not empty.
Also it takes care about the new option to display the page title before/after the site name (since Joomla 1.7?).
And finally the page title and the category title are displayed as page title.

To use it edit this file

/JOOMLAROOT/componentscom_phocadownload/site/views/category/view.html.php

and replace the code from line 235-249 with the new one.

If you also want to add the new option to the categories view change the following file:

/JOOMLAROOT/componentscom_phocadownload/site/views/categories/view.html.php

and replace the code from line 92-103 with this one

Code: Select all

		// get page title
		$title = $this->params->get('page_title', '');
		// if no title is set take the sitename only
		if (empty($title)) {
			$title = $app->getCfg('sitename');
		}
		// else add the title before or after the sitename
		elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
			$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
		}
		elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
			$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
		}
		$this->document->setTitle($title);
Last but not least you can edit this file if you want the file view to display the file title as page title:

/JOOMLAROOT/componentscom_phocadownload/site/views/file/view.html.php

and replace the code from line 196-205 with this one

Code: Select all

		// get page title
		$title = $this->params->get('page_title', '');
		// if the page title is set append the file title (if set!)
		if (!empty($title) && !empty($this->file[0]->title)) {
			$title .= " - " . $this->file[0]->title;
		}
		// if still is no title is set take the sitename only
		if (empty($title)) {
			$title = $app->getCfg('sitename');
		}
		// else add the title before or after the sitename
		elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
			$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
		}
		elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
			$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
		}
		$this->document->setTitle($title);
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48595
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Titles, Meta Description, Meta Keywords

Post by Jan »

Added these changes to 2.1.5

Thank you, Jan
If you find Phoca extensions useful, please support the project
SonRiab
Phoca Professional
Phoca Professional
Posts: 258
Joined: 02 Jun 2011, 09:29
Contact:

Re: Titles, Meta Description, Meta Keywords

Post by SonRiab »

It was a pleasure for me Jan! :P
vin86
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 01 Apr 2012, 22:17

Re: Titles, Meta Description, Meta Keywords

Post by vin86 »

hi, for version PD 1.3.9 in joomla 1.5 which files I need to change?

Thanks
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48595
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Titles, Meta Description, Meta Keywords

Post by Jan »

Hi, this should be the same files.

Jan
If you find Phoca extensions useful, please support the project
vin86
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 01 Apr 2012, 22:17

Re: Titles, Meta Description, Meta Keywords

Post by vin86 »

Jan wrote:Hi, this should be the same files.

Jan
Hi, this is my file view.html.php.

Code: Select all

<?php
/*
 * @package Joomla 1.5
 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 *
 * @component Phoca Component
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');

class PhocaDownloadViewFile extends JView
{

	function display($tpl = null){		
		global $mainframe;
		
		jimport( 'joomla.filesystem.folder' ); 
		jimport( 'joomla.filesystem.file' );
		
		$params 		= &$mainframe->getParams();
		$tmpl			= array();
		$tmpl['user'] 	= &JFactory::getUser();
		$uri 			= &JFactory::getURI();
		$model			= &$this->getModel();
		$document		= &JFactory::getDocument();
		//$categoryId	= JRequest::getVar('catid', 0, '', 'int');
		$fileId			= JRequest::getVar('id', 0, '', 'int');
		$limitStart		= JRequest::getVar( 'start', 0, '', 'int');// we need it for category back link
		

	
		$tmpl['limitstart'] = $limitStart;
		if ($limitStart > 0 ) {
			$tmpl['limitstarturl'] = '&start='.$limitStart;
		} else {
			$tmpl['limitstarturl'] = '';
		}
		
		$category		= $model->getCategory($fileId, $params);
		$file			= $model->getDocument($fileId, $params, $tmpl['limitstarturl']);
		
		$css						= $params->get( 'theme', 'phocadownload-grey' );
		$tmpl['licenseboxheight']	= $params->get( 'license_box_height', 300 );
		$document->addStyleSheet(JURI::base(true).'/components/com_phocadownload/assets/'.$css.'.css');
	
		$js				= 'var enableDownloadButtonPD = 0;'
						 .'function enableDownloadPD() {'
						 .' if (enableDownloadButtonPD == 0) {'
						 .'   document.forms[\'phocadownloadform\'].elements[\'pdlicensesubmit\'].disabled=false;'
						 .'   enableDownloadButtonPD = 1;'
						 .' } else {'
						 .'   document.forms[\'phocadownloadform\'].elements[\'pdlicensesubmit\'].disabled=true;'
						 .'   enableDownloadButtonPD = 0;'
						 .' }'
						 .'}';
		$document->addScriptDeclaration($js);
		
		// PARAMS
		$tmpl['filename_or_name'] 		= $params->get( 'filename_or_name', 'filename' );
		$tmpl['display_up_icon'] 		= $params->get( 'display_up_icon', 1 );
		$tmpl['allowed_file_types']		= PhocaDownloadHelper::getSettings( 'allowed_file_types', '' );
		$tmpl['disallowed_file_types']	= PhocaDownloadHelper::getSettings( 'disallowed_file_types', '' );
		$tmpl['enable_user_statistics']	= PhocaDownloadHelper::getSettings( 'enable_user_statistics', 1 );
		$tmpl['display_file_comments'] 	= $params->get( 'display_file_comments', 0 );
		$tmpl['file_icon_size'] 		= $params->get( 'file_icon_size', 16 );
		$tmpl['display_file_view']		= $params->get('display_file_view', 0);
		$tmpl['download_metakey'] 		= $params->get( 'download_metakey', '' );
		$tmpl['download_metadesc'] 		= $params->get( 'download_metadesc', '' );
		$tmpl['display_downloads'] 		= $params->get( 'display_downloads', 0 );
		$tmpl['display_date_type'] 		= $params->get( 'display_date_type', 0 );
		$tmpl['displaynew']				= $params->get( 'display_new', 0 );
		$tmpl['displayhot']				= $params->get( 'display_hot', 0 );
		$tmpl['phoca_dwnld']			= PhocaDownloadHelper::renderPhocaDownload();
		$tmpl['download_external_link'] = $params->get( 'download_external_link', '_self' );
		$tmpl['send_mail_download'] 	= $params->get( 'send_mail_download', 0 );// not boolean but id of user
		//$tmpl['send_mail_upload'] 		= $params->get( 'send_mail_upload', 0 );
		
		// Meta data
		if (isset($file[0]) && $file[0]->metakey != '') {
			$mainframe->addMetaTag('keywords', $file[0]->metakey);
		} else if ($tmpl['download_metakey'] != '') {
			$mainframe->addMetaTag('keywords', $tmpl['download_metakey']);
		}
		if (isset($file[0]) && $file[0]->metadesc != '') {
			$mainframe->addMetaTag('description', $file[0]->metadesc);
		} else if ($tmpl['download_metadesc'] != '') {
			$mainframe->addMetaTag('description', $tmpl['download_metadesc']);
		}

		// DOWNLOAD
		// - - - - - - - - - - - - - - - 
		$download				= JRequest::getVar( 'download', array(0), '', 'array' );
		$licenseAgree			= JRequest::getVar( 'license_agree', '', 'post', 'string' );
		$downloadId		 		= (int) $download[0];

		if ($downloadId > 0) {
		
			if (isset($file[0]->id)) {
				$currentLink	= 'index.php?option=com_phocadownload&view=file&id='.$file[0]->id.':'.$file[0]->alias. $tmpl['limitstarturl'] . '&Itemid='. JRequest::getVar('Itemid', 0, '', 'int');
			} else {
				$currentLink	= 'index.php?option=com_phocadownload&view=sections&Itemid='. JRequest::getVar('Itemid', 0, '', 'int');
			}
		
			
			// Check Token
			$token	= JUtility::getToken();
			if (!JRequest::getInt( $token, 0, 'post' )) {
				//JError::raiseError(403, 'Request Forbidden');
				$mainframe->redirect(JRoute::_('index.php', false), JText::_("Form data is not valid"));
				exit;
			}
			
			// Check License Agreement
			if (empty($licenseAgree)) {
				$mainframe->redirect(JRoute::_($currentLink, false), JText::_("You must agree to listed terms"));
				exit;
			}
			
			$fileData	= $model->getDownload($downloadId, $currentLink);
			
			PhocaDownloadHelperFront::download($fileData, $downloadId, $currentLink, $tmpl);
			
		}
		// - - - - - - - - - - - - - - - 
		
		// CSS Image Path
		$imagePath		= PhocaDownloadHelper::getPathSet('icon');
		$cssImagePath	= str_replace ( '../', JURI::base(true).'/', $imagePath['orig_rel_ds']);
		
		$filePath		= PhocaDownloadHelper::getPathSet('file');
		
		// Breadcrumbs
		$pathway 		=& $mainframe->getPathway();
		if (!empty($category[0]->sectiontitle)) {
			$pathway->addItem($category[0]->sectiontitle, JRoute::_(PhocaDownloadHelperRoute::getSectionRoute($category[0]->sectionid, $category[0]->sectionalias)));
		}
		if (!empty($category[0]->sectiontitle) && !empty($category[0]->sectionid)) {
			$pathway->addItem($category[0]->title, JRoute::_(PhocaDownloadHelperRoute::getCategoryRoute($category[0]->id, $category[0]->alias, $category[0]->sectionid)));
		}
		if (!empty($file[0]->title)) {
			$pathway->addItem($file[0]->title);
		}

		$this->assignRef('tmpl',			$tmpl);
		
		$this->assignRef('category',		$category);
		$this->assignRef('file',			$file);
		$this->assignRef('params',			$params);
		$this->assignRef('cssimagepath',	$cssImagePath);
		$this->assignRef('absfilepath',		$filePath['orig_abs_ds']);
		$this->assignRef('request_url',		$uri->toString());
		parent::display($tpl);
		
	}
}
?>
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48595
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Titles, Meta Description, Meta Keywords

Post by Jan »

So just add the modifications to this file.

Jan
If you find Phoca extensions useful, please support the project
Post Reply