di Agostino Zanutto
Joomla! HACK Nuovo post in categoria da menù
| Joomla! & Extensions |
Joomla 1.5.x non permette di inserire di creare dei link a menù in grado di far inserire un contenuto direttamente in una specifica categoria.
Questo piccolo hack vi permette di modificare farlo.
nota. ogni upgrade che dovessse modificare i file in oggetto rendera` nullo il funzionamento del link.
Nel file: 'components/com_content/views/article/view.html.php'
Dovrete modificare il blocco
227 228 229 230 231 232 233 234 235 236 237 |
if ($isNew) { // TODO: Do we allow non-sectioned articles from the frontend?? $article->sectionid = JRequest::getVar('sectionid', 0, '', 'int'); $db = JFactory::getDBO(); $db->setQuery('SELECT title FROM #__sections WHERE id = '.(int) $article->sectionid); $article->section = $db->loadResult(); } // Get the lists $lists = $this->_buildEditLists(); |
e sostituirlo con :
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
if ($isNew) { // TODO: Do we allow non-sectioned articles from the frontend?? $catid = JRequest::getVar('catid', 0, '', 'int'); $db = JFactory::getDBO(); if ($catid != 0) { $article->catid = $catid; $db->setQuery('SELECT section FROM #__categories WHERE id = '.(int) $article->catid); $article->sectionid = $db->loadResult(); } else { $article->sectionid = JRequest::getVar('sectionid', 0, '', 'int'); } $db->setQuery('SELECT title FROM #__sections WHERE id = '.(int) $article->sectionid); $article->section = $db->loadResult(); } // Get the lists $lists = $this->_buildEditLists($article); |
poi il blocco originariamente a linea 294 (prima della sostituzione del primo blocco a linea 285):
294 295 296 297 |
function _buildEditLists() { // Get the article and database connector from the model $article = & $this->get('Article'); |
e sostituirlo con :
294 295 296 297 298 |
function _buildEditLists(&$article = null) { // Get the article and database connector from the model if ($article == null) $article = & $this->get('Article'); |
Nel file: 'components/com_content/views/article/tmpl/form.xml'
poi dovrete aggiungere le seguenti linee dopo il tag 'description'
10 |
<description>ARTICLE SUBMISSION LAYOUT DESC</description>
|
linee (11,12,13):
10 11 12 13 |
<description>ARTICLE SUBMISSION LAYOUT DESC</description> <url> <param name="catid" type="category" label="Category" description="Choose a category..." /> </url> |
Menù -> Aspetto invio articoli


Ultimo aggiornamento (Venerdì 13 Maggio 2011 06:32)
