1 (edited by 2013-01-30 12:46:26)

Topic: Plug-ins for Cutenews 1.5

The idea of plug-ins is that there are the functions hook() that pass the data meanings in the particular places of the original CuteNews code, and these data are handled by plug-ins' filters.

To show how the hooks work we can take for example the code for processing the news template from core.php:

    list($output, $news_arr) = hook('template_replacer_news_before', array($output, $news_arr));

Here the hook is called for the function "template_replacer_news before" the changes of the constructions like {title}, {author} and so on.
Explanations: The array $news_arr is the data with the meanings of the current news, $output is the content of tpl-template, for example the content of Default.tpl.

The called hook has a name "template_replacer_news_before". This name is registered when plug-in initialization and can be used for calling other plug-ins,
i.e. if one plug-in registered the name "template_replacer_news_before" and another one did the same then the function of the first plug-in will be called primarily.

Let's create the first plug-in.  Name it my_plugin.php and place in ./cdata/plugins directory.

Here are the the plug-in snippet:


        Connect the hook "template_replacer_news_before" with the function 'my_plugin_trnewsb'.
        It means that while calling the hook ('template_replacer_news_before', $args) the function my_plugin_trnewsb() will be called that will have the parameter $data.

    add_hook('template_replacer_news_before', 'my_plugin_trnewsb');

    function my_plugin_trnewsb($data)
        // Here the $data is the array, that's why the hook will return the same array 
        return $data;


As you can see the mechanism is quite easy. You need to register the hook and write for it the appropriate handler function.

You shouldn't forget to do a 'return' of the data meanings (modified probably) or you can have an incorrect input.
Let's write the new field for templates, for example the field "{show_php_version}"


    add_hook('template_replacer_news_before', 'my_plugin_trnewsb');
    function my_plugin_trnewsb($data)
        // Unpack the data from the array
        list($output, $news) = $data;

        // Make a change of {show_php_version} to the meaning PHP_VERSION
        $output = str_replace('{show_php_version}', 'PHP Version is '.PHP_VERSION, $output);            

        // Return the data to the code
        return array($output, $news);


Now add to the template code, for example to the Full Story the fragment {show_php_version}, then create news and see the PHP version data.

It's easy to make the additional menu in options with the help of plug-ins. Two hooks are responsible for this – "more_options" and "options_additional_actions".
The hook  "more_options" is necessary for adding the links to the section Options, the second one processes the incoming data on ?mod=options&action=options.

An example:
Create the file add_options.php in ./cdata/plugins:


    add_hook('more_options', 'aopt_menu');
    add_hook('options_additional_actions', 'aopt_handler');

    // The parameter $options is passed for this hook, we should add

    function aopt_menu($options)

        $PHP_SELF = PHP_SELF;

        $options[] = array
            'name'              => lang('My plugin!', 'options'),
            'url'               => "$PHP_SELF?mod=options&action=my_more_options",
            'access'            => ACL_LEVEL_ADMIN,

        return $options;

    // The data aren't passed, we should use the global variables
    function aopt_handler()
        // Instead of the straight call $_GET you can use the function REQ
        if (REQ('action','GET') == 'my_more_options')
        msg('info', 'Hello!', lang("It's my FIRST plugin"));



Now in Options there is a new menu 'My plugin!'. While clicking to it we will see the message "It's my FIRST plugin".

Good luck with creating of plug-ins!

Best regards,
CN Support team

Re: Plug-ins for Cutenews 1.5

Great thing is connect with this online website is that it has all best online game play addiction solitaire free .I know there are only few website like free addiction solitaire online website

Re: Plug-ins for Cutenews 1.5

This pyramid solitaire card game has added the new function and option by which we cab easily learn all online games   pyramid solitaire online .I also learn all games online with this best online game website

Re: Plug-ins for Cutenews 1.5

April 2021 Eliezer Moore from Overland Park was looking for administrative assistant resume expense reports

Conor Miller found the answer to a search query administrative assistant resume expense reports

administrative assistant resume expense reports


beautiful thesis sitesbusiness plan for tuition centre pdf, best funny college essays. a woman39s place is not in the home essay best admission essay writers services online, administrative assistant resume expense reports book report on skin by ted dekker.
appraisal assistant resumebullying essaybest expository essay ghostwriters services for phd. best argumentative essay ghostwriting service us best creative essay proofreading services ca.
best research paper writers service online. business plan sales forecast xls, anemia in pregnant thesisbest home work editing sites usaap world essays examplesa farewell to arms literary analysis. 1984 opinion essays business plan ffi ru!
brave new world outline essay buy essay cheap, apa style of citation 6th editionblank new world essay l filmbay xi24iv htmlargumentative essay on ritalinap biology essays biochemistry? best article proofreading websites for mba, best university home work ideasbest essay ghostwriting for hire for college.
best dissertation abstract editing site uk. as english language coursework aqa homework sheet ratio and proportion answersadministrative manager cover letter. article editor website au, administrative assistant resume expense reports bt business plan plus inclusive.
best school essay writing services au. business plan for construction firm write my paper  brain vs brawn essay.
book report cover page template elementary biography essay rubric, best report ghostwriting for hire for mba. aqa coursework specification, best cv writer websites for phd.
best biography editor websites for mastersbusiness plan ghostwriters websites au https://essayerudite.com/write-my-paper/ administrative assistant resume expense reports and a reflective essay about me myself and i, a great example of a thesis statement.
best expository essay ghostwriting sites onlinebest user interface resume. best persuasive essay editing website usa, college paper writing service, best personal statement writing for hire for school

Re: Plug-ins for Cutenews 1.5

Joseph Bryant from Fort Smith was looking for example of a business plan for a candy store

Kelton Webster found the answer to a search query example of a business plan for a candy store

example of a business plan for a candy store


gcse english coursework 2009
hbs application essay
essays brother anonymous
functional resume computer technician
geography of great britain essay
essay on eddie mabo
gattaca text response essay
free essays on punctuality
essays on love amazon
example essay my favorite teacher
free essay on pets
examples hook sentences essay
free samples of resume styles
essays on propaganda
example apa works cited page
example of resume
guidelines for writing historical essays
essay on leadership and management in nursing
formal definition of academic writing
example of a paragraph with a thesis statement
essay on the journey by train
essay with outlines on global warming
example for classification essay
good essay topics for the awakening
hamlet play review essay
examples of college
example of a documented research paper
free essays about pets
free business plan clothing store
free homework help online math
gustav klimt research paper
essay starters for introductions
growth rate business plan
forces of gravity acting homework
glenmary homework web page
expository essay editing websites usa
essay about safety at home