Section & Category Descriptions-Images

Phoca Documentation - creating documentation in Joomla! CMS
User avatar
akerman
Phoca Member
Phoca Member
Posts: 42
Joined: 07 Jul 2008, 18:42
Location: Sweden - Stockholm
Contact:

Section & Category Descriptions-Images

Post by akerman »

Hi,

I have a request for the future releases.

The section description and the category description as well as their respective images. I would like them to be visible when viewing a section or a category.

In 'com_content' this is done as a table and I've tried to mimic that into the Section View for example. But somehow I only get the Section name, and the table layout. The description itself never show.

This one works:
<?php echo $this->escape($this->params->get('page_title')); ?>

This one does not:
<?php echo $this->section->description; ?>

When copied to the Phoca component from com_content...

Any quick ideas or pointers?


----------------------------------------------------------------------------------------------------------------------------
I saw your call for collaboration in answering questions in the forum. I will try to come back here more often to help out, so you can focus on the creation side more. I'm familiar with several of your extension and can hopefully answer a few questions, like I do at Virtuemart forum... :)

Regards
Akerman
http://www.AkermansCove.com - CMS Addons! & Royalty Free Images
http://www.InfoClip.se - Swedish site for Practical knowledge.
Ubuntu LAMP / Joomla 1.5.8 / VM 1.1.2 Stable / JoomFish / Mosets Tree
/ Joomsuite / Phoca / JoomGallery /
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47887
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Section & Category Descriptions-Images

Post by Jan »

Hi, thank you for answering the questions...

Description - this is a bug, I have fixed it for Phoca Download but still not for Phoca Documentation, the following code is missed in the view:
components/com_phocadocumentation/views/category/tmpl/default.php (category | section)

Code: Select all

// Description
echo '<div class="contentpane'.$this->params->get( 'pageclass_sfx' ).'">';
if ( (isset($this->tmpl['image']) && $this->tmpl['image'] !='') || (isset($this->category[0]->description) && $this->category[0]->description != '' && $this->category[0]->description != '<p>&#160;</p>')) {
	echo '<div class="contentdescription'.$this->params->get( 'pageclass_sfx' ).'">';
	if ( isset($this->tmpl['image']) ) {
		echo $this->tmpl['image'];
	}
	echo $this->category[0]->description
		.'</div><p>&nbsp;</p>';
}
echo '</div>';
and in models (category | section):

into SQL query of function _getCategoryQuery (_getSectionQuery in section) you should add:
FROM:

Code: Select all

$query = " SELECT cc.id, cc.title, cc.alias"
TO:

Code: Select all

$query = " SELECT cc.id, cc.title, cc.alias, cc.image, cc.image_position, cc.description"
should be fixed soon
Jan
If you find Phoca extensions useful, please support the project
User avatar
akerman
Phoca Member
Phoca Member
Posts: 42
Joined: 07 Jul 2008, 18:42
Location: Sweden - Stockholm
Contact:

Re: Section & Category Descriptions-Images

Post by akerman »

Hi,

Great Jan! I will try to patch this myself. :)

Thanx for sharing!

Regards
Akerman
http://www.AkermansCove.com - CMS Addons! & Royalty Free Images
http://www.InfoClip.se - Swedish site for Practical knowledge.
Ubuntu LAMP / Joomla 1.5.8 / VM 1.1.2 Stable / JoomFish / Mosets Tree
/ Joomsuite / Phoca / JoomGallery /
User avatar
akerman
Phoca Member
Phoca Member
Posts: 42
Joined: 07 Jul 2008, 18:42
Location: Sweden - Stockholm
Contact:

Re: Section & Category Descriptions-Images

Post by akerman »

Patching done! Piece of cake...love cake... :| Thanks for writing such easy code.

However, the Section / Category Image does not show up.


You know the image you can set in the left/right position and if you make a menuitem out of the section / category you can choose for it to show or not...

I think the reason for this is because the Section / Category isn't published through the menu links, the status of the image (show or not to show) is probably not set properly... or maybe it's just some code missing?

Otherwise the code is good!

Regards
Akerman
http://www.AkermansCove.com - CMS Addons! & Royalty Free Images
http://www.InfoClip.se - Swedish site for Practical knowledge.
Ubuntu LAMP / Joomla 1.5.8 / VM 1.1.2 Stable / JoomFish / Mosets Tree
/ Joomsuite / Phoca / JoomGallery /
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47887
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Section & Category Descriptions-Images

Post by Jan »

components\com_phocadocumentation\views\category\view.html.php

need to be added too:

Code: Select all

// Define image tag attributes
		if (!empty($category[0]->image)) {
			$attribs['align'] = '"'.$category[0]->image_position.'"';
			$attribs['hspace'] = '"6"';

			// Use the static HTML library to build the image tag
			$tmpl['image'] = JHTML::_('image', 'images/stories/'.$category[0]->image, JText::_('Phoca Download'), $attribs);
		} else {
			$tmpl['image'] = '';
		}

		$this->assignRef('tmpl',			$tmpl);
If you find Phoca extensions useful, please support the project
User avatar
akerman
Phoca Member
Phoca Member
Posts: 42
Joined: 07 Jul 2008, 18:42
Location: Sweden - Stockholm
Contact:

Re: Section & Category Descriptions-Images

Post by akerman »

Hmm, ok I tried this last code in view.html.php for Category but the image didn't show up.
(Inserted it into the 'function')

The logic seems a bit different too (tmpl vs. tpl ?)

So I tried to insert it in the /tmpl/default.php instead and also tried to add a echo for the image, with no result.

Obviously I'm doing something wrong....

Regards
Akerman
http://www.AkermansCove.com - CMS Addons! & Royalty Free Images
http://www.InfoClip.se - Swedish site for Practical knowledge.
Ubuntu LAMP / Joomla 1.5.8 / VM 1.1.2 Stable / JoomFish / Mosets Tree
/ Joomsuite / Phoca / JoomGallery /
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47887
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Section & Category Descriptions-Images

Post by Jan »

$tmpl is not $tpl

$tpl is a variable of Joomla! framework but
$tmpl is a variable of Phoca framework...

you can send variables into the "template" but e.g. in Phoca Gallery I had 20 variables to send them into the template, so instead of 20 variables I have made only 1 variable as an array:

So I need not to write 20 x
$this->assignRef('tmpl', $different_variable1);
$this->assignRef('tmpl', $different_variable2); ....

but I only write one row:
$this->assignRef('tmpl', $tmpl); // $tmpl is an array e.g. with 20 keys and values

And in template, the code get the value from:
$this->tmpl['image'];

You send $tmpl variable into the template and $tmpl contains $tmpl['image'] which you can use in template thanks $this->tmpl['image'];

Jan
If you find Phoca extensions useful, please support the project
User avatar
akerman
Phoca Member
Phoca Member
Posts: 42
Joined: 07 Jul 2008, 18:42
Location: Sweden - Stockholm
Contact:

Re: Section & Category Descriptions-Images

Post by akerman »

Ahh...

I'm always eager to learn, so thanks for taking the time and explain! :wink:

I will try again.

Regards,
http://www.AkermansCove.com - CMS Addons! & Royalty Free Images
http://www.InfoClip.se - Swedish site for Practical knowledge.
Ubuntu LAMP / Joomla 1.5.8 / VM 1.1.2 Stable / JoomFish / Mosets Tree
/ Joomsuite / Phoca / JoomGallery /
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47887
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Section & Category Descriptions-Images

Post by Jan »

Ok, please let me know, my problem is, I cannot test it for now because of my time, so maybe there is still missing something ... :(

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