How to retriev attribs data

212 views
Skip to first unread message

Antonio

unread,
Mar 21, 2012, 10:54:25 AM3/21/12
to joomla-de...@googlegroups.com
In #__content table there are a column "attribs", with something like that:

show_title=1
link_titles=2
show_intro=1
show_section=0
link_section=0
show_category=
link_category=
show_vote=
show_author=
show_create_date=
show_modify_date=
show_pdf_icon=
show_print_icon=
show_email_icon=
language=en_GB
keyref=
readmore=read more

If I get this column from database into a $var, how can I get individual
vars, something like:

$show_title = "1"

$language = "en_GB"?

Swapnil Shah

unread,
Mar 21, 2012, 10:56:37 AM3/21/12
to joomla-de...@googlegroups.com
That is in JSON format? if so feed the string to JRegistry. then you can
access those variables by

$attribs = new JRegistry(String);
$show_title = $attribs->get('show_title')

Neil

Antonio

unread,
Mar 21, 2012, 11:38:50 AM3/21/12
to joomla-de...@googlegroups.com
Unfortunately don't work.

Code:

        echo $itens['params'];
        $attribs = new JRegistry($itens['params']);
        $show_title = $attribs->get('catItemAuthor');
        echo "<br><br>extracted = ".$show_title;

Result:

catItemTitle= catItemTitleLinked= catItemFeaturedNotice= catItemAuthor=Maricio Pavanello catItemDateCreated= catItemRating= catItemImage= catItemIntroText= catItemExtraFields= catItemHits= catItemCategory= catItemTags= catItemAttachments= catItemAttachmentsCounter= catItemVideo= catItemVideoWidth= catItemVideoHeight= catItemAudioWidth= catItemAudioHeight= catItemVideoAutoPlay= catItemImageGallery= catItemDateModified= catItemReadMore= catItemCommentsAnchor= catItemK2Plugins= itemDateCreated= itemTitle= itemFeaturedNotice= itemAuthor= itemFontResizer= itemPrintButton= itemEmailButton= itemSocialButton= itemVideoAnchor= itemImageGalleryAnchor= itemCommentsAnchor= itemRating= itemImage= itemImgSize= itemImageMainCaption= itemImageMainCredits= itemIntroText= itemFullText= itemExtraFields= itemDateModified= itemHits= itemCategory= itemTags= itemAttachments= itemAttachmentsCounter= itemVideo= itemVideoWidth= itemVideoHeight= itemAudioWidth= itemAudioHeight= itemVideoAutoPlay= itemVideoCaption= itemVideoCredits= itemImageGallery= itemNavigation= itemComments= itemTwitterButton= itemFacebookButton= itemGooglePlusOneButton= itemAuthorBlock= itemAuthorImage= itemAuthorDescription= itemAuthorURL= itemAuthorEmail= itemAuthorLatest= itemAuthorLatestLimit= itemRelated= itemRelatedLimit= itemRelatedTitle= itemRelatedCategory= itemRelatedImageSize= itemRelatedIntrotext= itemRelatedFulltext= itemRelatedAuthor= itemRelatedMedia= itemRelatedImageGallery= itemK2Plugins=

extracted =

elin

unread,
Mar 22, 2012, 7:58:41 AM3/22/12
to joomla-de...@googlegroups.com
You are looking at 1.5 which is why it isn't in JSON.
The core files of 1.5 show hundreds of examples of how to do this.  For example simply open the view.html.php and default layout files for the front end article view. They illustrate how to get the parameters and correctly merge them with menu parameters if desired.

Elin
Reply all
Reply to author
Forward
0 new messages