Fork me on GitHub

News module > email news summary/link  Bottom

  • Is there built in functionality somewhere to email a news summary and link?
  • From where and how exactly. I dont think there is something like that at the moment. I'm not sure if there still is a recommendThis module of some sort.

    --
    campertoday.nl, Module development, Dutch Zikula Community
  • You can still use the Recommend_Us module in the Value Addons. It contains a plugin which even shows how to use it in the News module. icon_smile
  • Ok great icon_smile . So try it out Craig and let us know if all works out.

    --
    campertoday.nl, Module development, Dutch Zikula Community
  • Eh, I would like this to work, - But I don't get how to make it work. It keeps returning the article page. if there is a proper link can it be posted?

    --
    Paul
    ____________________________________________________
    "...Humor, ITs just a state of mind"
    TakeIT2.CoM :: Open Destination
    ...my site is a perfect example of why doctors do not operate on them self :)
  • I don't understand your question. what is a proper link?
  • maybe "proper" is a little loose of a term.
    I mean an example of how and why a link works and where a variation/modification might happen.

    Some of us are not as good at working it out - namely, me. :)

    the sample in the the recommend_us module, all that is there is:

    Code

    < !- -[recommend modname=News itemid="1" start="[" end="]"]- - >

    As a sample or example, it no longer works as far as I can tell, I think It was written for a version or two back in the News module. Reworking it to the current standard is not my strong point. Unless I am just missing something so blatantly obvious to others (which can happen.)And that is supposed to show me as well how to figure out the way to apply it to more than just the news module too?

    by looking at it, I read it as:
    recommend > use the recommend plugin (does the plugin have to be copied to the modules plugin folder?)

    module=News > is the module calling the plugin or the module to apply the plugin to (?)

    itemid="1" > is a true or false, 1 being true (?) so apply it to the current story ID (?)

    The part that really throws me is the Start= and end= - I don't know how to read that...
    and I am not sure I am reading the rest right at all.

    Paul

    --
    Paul
    ____________________________________________________
    "...Humor, ITs just a state of mind"
    TakeIT2.CoM :: Open Destination
    ...my site is a perfect example of why doctors do not operate on them self :)
  • The recommend function is part of the Recommend_Us module. It is in the pntemplates/plugins directory.

    Code

    /**
     * Smarty function to create a recommend link for an item
     *
     * Example
     *
     *
     * @author       Mark West
     * @since        14/07/04
     * @see          function.recommend.php::smarty_function_recommend()
     * @param        array       $params      All attributes passed to this function from the template
     * @param        object      &$smarty     Reference to the Smarty object
     * @param        integer     $sid         article id
     * @param        string      $start       start string
     * @param        string      $end         end string
     * @param        string      $seperator   link seperator
     * @param        string      $class       CSS class
     * @return       string      the results of the module function
     */

    function smarty_function_recommend($params, &$smarty)
    {
        if (!isset($params['modname'])) {
            $smarty->trigger_error('recommend: attribute modname required');
            return false;
        }

        if (!isset($params['itemid'])) {
            $smarty->trigger_error('recommend: attribute itemid required');
            return false;
        }

        // set some defaults
        if (!isset($params['start'])) {
            $params['start'] = '[';
        }
        if (!isset($params['end'])) {
            $params['end'] = ']';
        }
        if (!isset($params['src'])) {
            $params['src'] = "images/global/friend.gif";
        }

        $recommendlink = '';

        if (pnModAvailable('Recommend_Us')) {
            pnModLangLoad('Recommend_Us', 'user');
            $link = DataUtil::formatForDisplay(pnModURL('Recommend_Us', 'user', 'view', array('modname'=> $params['modname'], 'objectid' => $params['itemid'])));
            $recommendlink = $params['start'] . "  " . $params['end'];
        }

        return $recommendlink;
    }


    So, if the code above makes sense to you, then you can probably answer your own questions, but the start and end arguments basically put those brackets around the link that is generated.

    The itemID is the news article ID I think.

    I reworked some of that module after my original post as it didn't do quite what I wanted. but I don't remember what I changed exactly.



    edited by: craigh, May 17, 2009 - 12:38 PM
  • So that is how you modified the plugin ? That is not the same as what shipped in zk 1.1.1. Since you pulled the example out too, what do you use to trigger the plugin?

    --
    Paul
    ____________________________________________________
    "...Humor, ITs just a state of mind"
    TakeIT2.CoM :: Open Destination
    ...my site is a perfect example of why doctors do not operate on them self :)
  • yeah - that must be now I modified it... not sure. I would have probably called it like

    Code

    <!--[recommend modname=News itemid="1" ]-->


    but in the template you have to replace the "1" with a variable.
  • I just typed in a large reply which did not arrive icon_frown So here goes again.

    The Recommend_Us module still uses some News 1.3 pn764 code in the pnuser.php user_view, but it should be ok, since the code checks for a pnAPI module (which News now is) and uses the get method on the module.

    Code

    // load the module API and get the item
        if ($objectid && is_numeric($objectid)) {
            if (isset($modname) && pnModAvailable($modname)) {
                $modinfo = pnModGetInfo(pnModGetIDFromName($modname));
                    $pnRender->assign('modname', $modname);
                    $pnRender->assign('objectid', $objectid);
                if ($modinfo['type'] == 2) {
                    $item = pnModAPIFunc($modname, 'user', 'get', array('objectid' => $objectid));
                    $pnRender->assign($item);
                } else if ($modname == 'News' && $modinfo['type'] == 1) {
                    include_once('modules/'.$modinfo['directory'].'/funcs.php');
                    $pntable = pnDBGetTables();
                    $results = getArticles("{$pntable['stories_column']['sid']}='" . (int)DataUtil::formatForStore($objectid) . "'");
                    $info = genArticleInfo($results[0]);
                    $links = genArticleLinks($info);
                    $item = array_merge($info, $links);
                    $pnRender->assign($item);
                }
            }
        }

    Some code updates might be nice, I will file some tickets and try to solve in Parked as well.
    Furthermore the plugin has a bug in there, you will need to adjust the Recommend_Us plugin which is in modules/Recommend_Us/pntemplates/plugins/function.recommend.php
    The code now reads:

    Code

    $link = DataUtil::formatForDisplay(pnModURL('Recommend_Us', 'user', 'view', ...
    $recommendlink = $params['start'] . " <a href=\"" . $params['link'] . "\"><img src=\"images/global/friend.gif\" ...

    and has to be changed into (the link call is incorrect):

    Code

    $link = DataUtil::formatForDisplay(pnModURL('Recommend_Us', 'user', 'view', ...
    $recommendlink = $params['start'] . " <a href=\"" . $link . "\"><img src=\"images/global/friend.gif\" ...

    The plugin itself can be called in news_user_index.htm for instance below you article text with

    Code

    <!--[recommend modname="News" itemid=$info.sid start="[" end="]"]-->

    The itemid should be the article id and $info.sid contains that value within the News templates. The plugin will then display an image with a link, prefixed with what is in the start param and suffixed with what is in the end param.
    The image is by default images/global/friend.gif, you might want to change that as well. A nicer image might be images/icons/extrasmall/mail_forward.gif
    It would be nice of course if you could set this with a parameter in the plugin (like text/image and what image, etc).

    When using it like above in my zk111 site it works.

    --
    campertoday.nl, Module development, Dutch Zikula Community
  • Yea, I think that did it Erik, If you got mail It worked. :)

    At first I didn't notice the "..." but I got it, and yea, the forward mail icon works good.

    I saved this version of the plugin in mytheme/templates/news/plugins

    --
    Paul
    ____________________________________________________
    "...Humor, ITs just a state of mind"
    TakeIT2.CoM :: Open Destination
    ...my site is a perfect example of why doctors do not operate on them self :)
  • Eric - maybe you and I should put our heads together on an update to that module... can you get it into the Cozi and get us both SVN access?
  • Hi Craig, I already have access to the Parked Cozi, I updated the plugin of Recommend_Us already, since that bug was very obvious and really wrong (check out the Parked timeline). The other updates I merely put in a ticket. I'm not sure if I'm the person to give you access, I think that should be Axel, or carsten or Mateo.
    But sure, some updates are needed icon_smile

    --
    campertoday.nl, Module development, Dutch Zikula Community
  • 0 users

This list is based on users active over the last 60 minutes.