homejoomlablogministries
articles
guides
tutorials
all
forum
Subscribe in NewsGator Online

Learning Joomla! for the first time? Buy the Joomla! 1.5 Essential training CD-ROM or watch it on Lynda.com.

 

Welcome to Joseph LeBlanc's Joomla development forum. This forum is primairly intended to discuss the development of components I've authored, such as the podcasting suite and Daily Message tutorial. Although I happily answer general questions about Joomla, you may get quicker answers by searching the Joomla forums.

Due to spam abuse, you must register to post in the forums. However, you are allowed to browse the forums without registration. Commercially-oriented, off-topic messages are $100 per word, thank you for understanding!






FireBoard
Welcome, Guest
Please Login or Register.    Lost Password?
Component publishing (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Component publishing
#2403
Ben (User)
Fresh Boarder
Posts: 1
graphgraph
User Offline Click here to see the profile of this user
Component publishing 1 Year, 3 Months ago Karma: 0  
Hey Joseph,
I've ran through the Extension Development book and have run into an issue with Joomla! 1.5. When creating components, I can not seem to get the publish/unpublish icon to function as intended and was wondering if you had a solution or any tips. Here is my display function:

function showKinesisAvailable($option, &$rows)
{
echo '<form action="index.php" method="post" name="adminForm">';
echo '<table class="adminlist">';

echo '<thead>';
echo '<tr>';

echo '<th width="20">';
echo '<input type="checkbox" name="toggle" value="" onclick="checkAll('.count($rows).';" />';
echo '</th>';

echo '<th class="title">Name</th>';
echo '<th width="20%" nowrap="nowrap">Page title</th>';
echo '<th width="5%" nowrap="nowrap">Published</th>';

echo '</tr>';
echo '</thead>';

jimport('joomla.filter.output';
$k = 0;
$i = 0;
$n=count($rows);
while($i < $n)
{
$row = $rows[$i];
$checked = JHTML::_('grid.id',$i,$row->id);
$published = JHTML::_('grid.published',$row,$i);
$link = JFilterOutput::ampReplace('index.php?option='.$option.'&task=edit&cid[]=&#039;.$row-&gt;id);
echo &#039;&lt;tr class=&quot;row&quot;&#039;.$k.&#039;&quot;&gt;&#039;;
echo &#039;&lt;td&gt;&#039;;
echo $checked;
echo &#039;&lt;/td&gt;&#039;;

echo &#039;&lt;td&gt;&#039;;
echo &#039;&lt;a href=&quot;&#039;.$link.&#039;&quot;&gt;&#039;;
echo $row-&gt;name;
echo &#039;&lt;/a&gt;&#039;;
echo &#039;&lt;/td&gt;&#039;;

echo &#039;&lt;td&gt;&#039;;
echo $row-&gt;title;
echo &#039;&lt;/td&gt;&#039;;

echo &#039;&lt;td align=&quot;center&quot;&gt;&#039;;
echo $published;
echo &#039;&lt;/td&gt;&#039;;

echo &#039;&lt;/tr&gt;&#039;;

$k = 1 - $k;
$i++;
}

echo &#039;&lt;/table&gt;&#039;;
echo &#039;&lt;input type=&quot;hidden&quot; name=&quot;option&quot; value=&quot;&#039;.$option.&#039;&quot; /&gt;&#039;;
echo &#039;&lt;input type=&quot;hidden&quot; name=&quot;task&quot; value=&quot;&quot; /&gt;&#039;;
echo &#039;&lt;input type=&quot;hidden&quot; name=&quot;boxchecked&quot; value=&quot;0&quot; /&gt;&#039;;

echo &#039;&lt;/form&gt;&#039;;
}

I had to change JOutputFilter to JFilt;
$checked = JHTML::_('grid.id',$i,$row->id);
$published = JHTML::_('grid.published',$row,$i);
$link = JFilterOutput::ampReplace('index.php?option='.$option.'&task=edit&cid[]='.$row->id);
echo '<tr class="row"'.$k.'">';
echo '<td>';
echo $checked;
echo '</td>';

echo '<td>';
echo '<a href="'.$link.'">';
echo $row->name;
echo '</a>';
echo '</td>';

echo '<td>';
echo $row->title;
echo '</td>';

echo '<td align="center">';
echo $published;
echo '</td>';

echo '</tr>';

$k = 1 - $k;
$i++;
}

echo '</table>';
echo '<input type="hidden" name="option" value="'.$option.'" />';
echo '<input type="hidden" name="task" value="" />';
echo '<input type="hidden" name="boxchecked" value="0" />';

echo '</form>';
}

I had to change JOutputFilter to JFilterOutput in order to find the class. Other than that, I couldn't really find any thing glaring in the differences between the code and book. Any help/tips would be appreciated. Thanks!
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#2426
jleblanc (Admin)
Admin
Posts: 1021
graph
User Offline Click here to see the profile of this user
Re:Component publishing 1 Year, 2 Months ago Karma: 32  
Thanks for buying the book! Do you have code in your component that checks for the 'publish' and 'unpublish' tasks? (The book doesn't cover these functions until Chapter 6.)
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#3539
kernel52 (User)
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
Re:Component publishing 1 Month ago Karma: 0  
Hello!
I've been having the same problem as Ben. The thing is that I read a little further on the book and found out that after you modify your component you change the line into $published = JCommonHTML:: PublishedProcessing( $row, $i );

So, I said why not add it in the basic component? But this throws a Fatal error: Class 'JCommonHTML' not found...

When I checked on the web somebody proposed to change this into the code that it was before, which leads us to the not working problem again...

i admit that I don't really get along with Javascript but for what I understand something is not defined in order to grab the id and alter the Published state.

Is there any simple way to change this before moving to a more advanced model of component as you propose on Chapter 6?

Thank you in advance for your answer
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#3542
jleblanc (Admin)
Admin
Posts: 1021
graph
User Offline Click here to see the profile of this user
Re:Component publishing 1 Month ago Karma: 32  
Thanks for reading the book! I think if you go through it chapter at a time, it will make more sense. The calls to JCommonHTML are used to create the links for publishing and unpublishing, but you have to have certain parts on your form before they work (like the 'task' hidden variable and the checkboxes).
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#3546
kernel52 (User)
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
Re:Component publishing 1 Month ago Karma: 0  
Thank you very much for the answer! I will go back to the book and read the chapter again!
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop