Joomla Field - Title with alias
Geir
Yeni Üye
Posts: 15
9 yıl 10 ay önce #650
Yazan: Geir
Joomla Field - Title with alias, Geir tarafından oluşturuldu
Here is a quick recipe to create URL safe aliases. It does not include routing, if you need it, check out the
Joomla! docs
.
1. Create title and alias in your component, as regular Joomla textfield.
2. Build your component and unzip component.
3. Locate com_yourComponent\administrator\tables\yourTable.php and addto public function check()
4. Locate com_yourComponent\administrator\models\forms\yourTable.xml and replace title and alias fields with5. Locate com_yourComponent\administrator\views\yourTable\tmpl\edit.php and remove the title and alias fields, then add as the first line after the opening form tag
That's it! If I haven't forgotten anything at least (if I have, let me know so I can correct it).
Your title and alias fields are now using joomlas own strings, so you could clean up your language files as well.
1. Create title and alias in your component, as regular Joomla textfield.
2. Build your component and unzip component.
3. Locate com_yourComponent\administrator\tables\yourTable.php and add
jimport('joomla.filter.output');
if (empty($this->alias))
{
$this->alias = $this->title;
}
$this->alias = JFilterOutput::stringURLSafe($this->alias);
4. Locate com_yourComponent\administrator\models\forms\yourTable.xml and replace title and alias fields with
<field name="title" type="text" label="JGLOBAL_TITLE"
description="JFIELD_TITLE_DESC"
class="input-xxlarge input-large-text"
size="40"
required="true" />
<field name="alias" type="text" label="JFIELD_ALIAS_LABEL"
description="JFIELD_ALIAS_DESC"
hint="JFIELD_ALIAS_PLACEHOLDER"
size="40" />
<?php echo JLayoutHelper::render('joomla.edit.title_alias', $this); ?>
That's it! If I haven't forgotten anything at least (if I have, let me know so I can correct it).
Your title and alias fields are now using joomlas own strings, so you could clean up your language files as well.
Şu kullanıcı(lar) Teşekkür etti: Fusió d'Arts Technology S.L., Andres Maeso, Juanjo vazquez real, Marinus Moerland, Pontus Karlsson, Виталий
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
Gosling Cools
Bakır Üye
Posts: 20
9 yıl 9 ay önce #699
Yazan: Gosling Cools
Gosling Cools tarafından Joomla Field - Title with alias konusunda yanıtlandı
Didn't know about number 5. Great!
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
Geir
Yeni Üye
Posts: 15
9 yıl 2 ay önce - 9 yıl 2 ay önce #1034
Yazan: Geir
Geir tarafından Joomla Field - Title with alias konusunda yanıtlandı
It's great to see you have implemented the routing feature for alias field.
My temporary solution however, is still valid, as it adds the missing parts of your implementation.
- Title/alias layout.
- URLsafe alias autogenerated from title
My temporary solution however, is still valid, as it adds the missing parts of your implementation.
- Title/alias layout.
- URLsafe alias autogenerated from title
Son Düzenleme: 9 yıl 2 ay önce Düzenleyen:Geir
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
Sayfa oluşturma süresi: 0.052 saniye