Topic: Call var in addFilter

Hello users i have a question in  addFilter functioçn .

I have this code:

// Get images {gallery}
Morfy::factory()->addFilter('content', function($content){
    $files = Morfy::getFiles('public/images_folder'); // get files
    $out = '';
    return str_replace('{gallery}', $out, $content);
});

How to call the url of images like

{gallery id="public/images_folder"}

?

..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

nakome's Website

2 2014-02-01 18:58:58

Re: Call var in addFilter

you mean: how to pass params inside filter ?

Monstra Loves You! Give some love back!

Re: Call var in addFilter

There is no Built in Shortcode API in Morfy. You can use same code as for templates in page content

Check http://morfy.monstra.org/blog/morfy-1.0.5

Morfy::factory()->addAction('gallery', function($message) {
    echo $message;
});

and

{php} Morfy::factory()->runAction('gallery', array('message' => 'Hello World!')); {/php}
Monstra Loves You! Give some love back!

Re: Call var in addFilter

Ah ok thanks i try this solution:

i have oder question this is good for call plugins ?

Example only comments for one page:

Morfy::factory()->addFilter('content', function($content){
    $code = Morfy::factory()->runAction('discus');
    return str_replace('{discus}', $code, $content);
});

And call with

{discus}
..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

nakome's Website

5 2014-02-01 21:01:49

Re: Call var in addFilter

it is ok

Monstra Loves You! Give some love back!

Re: Call var in addFilter

ok thanks smile

..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

nakome's Website