solved How to Make a Module's Meta Data Available to a Template

PatriaCo
PatriaCo
@the-patria-company
5 years ago
349 posts
I need to write some logic that requires a piece of data from my custom module's meta data:

As an example let's use the jrBlog_meta and add a piece of data to the array called 'ampify'
function jrBlog_meta(){
    $_tmp = array(
        'name'        => 'Blog',
        'url'         => 'blog',
        'version'     => '1.1.18',
        'developer'   => 'The Jamroom Network, ©' . strftime('%Y'),
        'description' => 'Add blogging capabilities to profiles',
        'doc_url'     => 'https://www.jamroom.net/the-jamroom-network/documentation/modules/2856/profile-blog',
        'category'    => 'profiles',
        'license'     => 'mpl'
        'ampify' => 'true'
    );
    return $_tmp;
}

What function do I need to add to my custom module's include.php to make this piece of data available to my skin's header.tpl?


--
The Patria Company - patriaco.com / quality-trades.com / a-t.life - doing Jamroom since v3

updated by @the-patria-company: 06/16/19 10:53:49PM
paul
@paul
5 years ago
4,330 posts
Just run the function from the template -
{$_Blog_meta = jrBlog_meta()}
$_Blog_meta would then be an array of all the meta data, so -
{if $_Blog_meta.ampify == 'whatever'}
    // Do stuff
{/if}

hth


--
Paul Asher - JR Developer and System Import Specialist
PatriaCo
PatriaCo
@the-patria-company
5 years ago
349 posts
Thank you!! I got it working :) That is going to make my logic so much more simplified. Thanks again!!


--
The Patria Company - patriaco.com / quality-trades.com / a-t.life - doing Jamroom since v3

Tags