Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- internetking created topic »password problem« 25. May
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 25. May
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 25. May
- ehdwma created topic »Hide "Register new account" and change template to 3 col« 25. May
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 25. May
- mdee created topic »How to implement returnpage ?« 25. May
- nestormateo responded to »Fillters in Clip« 24. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
News module > email news summary/link
-
- Rank: Developer
- Registered: Jun 16, 2003
- Last visit: May 29, 2010
- Posts: 1966
Is there built in functionality somewhere to email a news summary and link? -
- Rank: Developer
- Registered: Aug 23, 2003
- Last visit: May 31, 2010
- Posts: 1428
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 -
- Rank: Developer
- Registered: Aug 23, 2003
- Last visit: May 31, 2010
- Posts: 1428
Ok great
. So try it out Craig and let us know if all works out.
--
campertoday.nl, Module development, Dutch Zikula Community -
- Rank: Developer
- Registered: Dec 31, 1969
- Last visit: May 31, 2010
- Posts: 303
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 :) -
- Rank: Developer
- Registered: Jun 16, 2003
- Last visit: May 29, 2010
- Posts: 1966
-
- Rank: Developer
- Registered: Dec 31, 1969
- Last visit: May 31, 2010
- Posts: 303
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
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 :) -
- Rank: Developer
- Registered: Jun 16, 2003
- Last visit: May 29, 2010
- Posts: 1966
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 -
- Rank: Developer
- Registered: Dec 31, 1969
- Last visit: May 31, 2010
- Posts: 303
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 :) -
- Rank: Developer
- Registered: Jun 16, 2003
- Last visit: May 29, 2010
- Posts: 1966
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. -
- Rank: Developer
- Registered: Aug 23, 2003
- Last visit: May 31, 2010
- Posts: 1428
I just typed in a large reply which did not arrive
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 -
- Rank: Developer
- Registered: Dec 31, 1969
- Last visit: May 31, 2010
- Posts: 303
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 :) -
- Rank: Developer
- Registered: Aug 23, 2003
- Last visit: May 31, 2010
- Posts: 1428
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
--
campertoday.nl, Module development, Dutch Zikula Community
- Moderated by:
- Support
Users on-line
- 0 users
This list is based on users active over the last 60 minutes.
