Forums

Show icon next to title if article has attachment

freefall 19 Feb, 2010
Hope somebody can help me one more time. :mrgreen:

I read from the other post that form variables can not go to category list page as an added table column.

How about showing an icon next to title(that way no extra column needed) so that people know this article has attachment?

$title = JRequest::getVar('title', '');
if ( $title ) {
	 $title_hasfile = str_replace("{title}", '<span><img src="images/icon_file.gif/'.JRequest::getVar("title").'"/></span>', $title_hasfile);
}else {
  $title_hasfile = str_replace("{title}", '', $title_hasfile);}
JRequest::setVar("title", $title_hasfile); 


Of course, this doesn't work.
Please don't laugh at me!
GreyHead 19 Feb, 2010
Hi freefall,

It's past midnight nere so I'm not going to solve it for you now but the code you have looks pretty close.

Bob
freefall 20 Feb, 2010
I opened many joomla files to figure out what the correct syntax is. I mixed /matched/tried many combination, but failed.. could you take a look?😶

It shows file path, not the actual image. Thank you.

$title_hasfile="{title}";
$title = JRequest::getVar('title', '');
if ( $file_1 ) {
$title_hasfile =  JRequest::getVar('title', '', 'post'). ' ' . JHTML::_('image','images/icon_file.gif',null) ; 

}else {
  $title_hasfile = JRequest::getVar('title', '', 'post');}

JRequest::setVar("title", $title_hasfile); 
GreyHead 21 Feb, 2010
Hi freefall,

Where exactly are you putting this code. I'm not sure if this is ChronoForms or ChronoConnectivity? And which box are you putting it in?

Bob
freefall 21 Feb, 2010
Hi,
I am using it ChronoForms 'On Submit Code- after sending email'.
GreyHead 21 Feb, 2010
Hi freefall,

And where are you displaying the result - there's no echo or print line in that code snippet??

Bob
nml375 21 Feb, 2010
Hi all,
I belive the issue here lies in that the title is passed through the escape() method in the current JView instance used to display the article list. As such, any html-codes in the title will be "properly" encoded, and displayed in plaintext. That's even if you manually add the <img /> tag to the database record using perhaps phpMyAdmin.

Unless you are willing to rewrite the com_content component rather extensively, you will not be able to achieve this. It's not a limit of ChronoForms, but of the Content component.

/Fredrik
freefall 21 Feb, 2010
I see... Now i can happily give up on this. Thank you. 😀
This topic is locked and no more replies can be posted.