Basically, I've got a variable in com_mycomponent/views/mycomponent/tmpl/default.php
Which looks like this:
Code: Select all
$file = $fileRS->fields['filename']->value;
It returns the filename of a document from an Indexing Server Catalog object. And it works.
I want to pass $file back to a function in com_mycomponent/models/mycomponent.php
here's my function:
Code: Select all
function getDOCmanDocName($file)
{
$db =& JFactory::getDBO();
$query = 'SELECT dmname AS text'
. ' FROM #__docman'
. ' WHERE dmfilename = ' . $file;
$db->setQuery( $query );
$docname = $db->loadResult();
return $docname;
}
I know I can echo $this->docname; in default.php thus calling the function getDOCmanDocName via view.html e.g. in view.html:
Code: Select all
$model =& $this->getModel();
$docname = $model->getDOCmanDocName();
$this->assignRef('docname', $docname);
But how do I pass back $file to the function? I've tried: $this->docname($file) - but don't know if this is valid, and if it is, how do I edit view.html?
Would appreciate thoughts anyone.. thanks
chris