Thursday, June 30, 2011

joomla 1.6 custom article fields

Hackedey hack hack

add fields to jos_content as you please

add fields to article.xml in components>com_content>models>forms>article.xml like so

class="inputbox" description="custom" field="" id="custom" label="custom" name="custom" size="20" type="text"


then you can use it in stuff like  components>com_content>models>forms>tmpl>edit.php like so

    form->getInput('custom');

then you can use those fields in a template override

if you want to access the fields in a module like mod_articles_category change helper to include
        $item->custom = $item->custom;
near this line
        $item->slug = $item->id.':'.$item->alias;


AND the seclect clause in components>com_content>models>articles.php
        $this->getState(
                'list.select',
                'a.id, a.title, a.alias, a.title_alias, a.introtext, a.custom, ' .

then you can override the mudule in templates>html and use
        echo $item->custom;
like
  echo $item->title;

1 comment:

write articles said...

I must appreciate you for the information you have shared.I find this information very useful and it has considerably saved my time.thanks:)