LostKobrakai Posted March 17, 2015 Share Posted March 17, 2015 You could use FieldtypeConcat for that job, so you even wouldn't need to have the foreach loop. Link to comment Share on other sites More sharing options...
joe_g Posted March 17, 2015 Share Posted March 17, 2015 thanks, but to make things more complicated i only need to do it sometimes, not on all items... So if possibly I'd want to loop over the items. not sure what happened with the double post, but thanks for deleting it J Link to comment Share on other sites More sharing options...
LostKobrakai Posted March 17, 2015 Share Posted March 17, 2015 Another thing to your entry post, please use the code boxes for code. foreach($myPages as $p) { $p->set("your_new_field", $p->field.$p->anotherfield); //Field is runtime only } Maybe this works. You'd need to fill the field for each page. Even if it's different contentwise. 1 Link to comment Share on other sites More sharing options...
joe_g Posted March 19, 2015 Share Posted March 19, 2015 Ah yes, temporarily make a new field. Great, thanks! j Link to comment Share on other sites More sharing options...
Fester Posted April 2, 2015 Share Posted April 2, 2015 Hi Is there any way to add fields to the feed for each item? I might have missed something really obvious but I can't figure this out. Loving processwire so far! Link to comment Share on other sites More sharing options...
Soma Posted April 2, 2015 Share Posted April 2, 2015 To all those with special cases. Why not just create an Rss manually? Few lines of code really. If after all you have to loop them anyway I don't see why use a module for it. 1 Link to comment Share on other sites More sharing options...
Fester Posted April 3, 2015 Share Posted April 3, 2015 Ah thanks Soma! Just wanted to confirm that there's no way to do this before I manually coded my own RSS feed. Link to comment Share on other sites More sharing options...
Webrocker Posted April 30, 2015 Share Posted April 30, 2015 Hi, sorry if this already has been covered, but I just stumbled over an issue: If the pages in $items = $pages->find(....) use a template that has no template.php file in /templates/, then nothing will be returned by the $rss->render($items) Even though $items is fetched correctly and could be debugged like var_dump($items[0]->title) ... The strange thing is, only the template.php file needs to be there, even if it's empty. Since the $rss->render() is used on a different template anyway (for showing the rss"page"), there shouldn't be a need to have the template for the "fetched" pages…? cheers,Tom Link to comment Share on other sites More sharing options...
Macrura Posted April 30, 2015 Share Posted April 30, 2015 yeah, ran into this issue recently and was banging my head against a wall until i realized my items needed a template, because the rss feed needs a link for the items; in my case, the template for the RSS item does a simple redirect to it's parent page with a hash to the id of the item (it is an event listing). if you don't have a template for the RSS item, how would people click on the link to your item? 1 Link to comment Share on other sites More sharing options...
Webrocker Posted April 30, 2015 Share Posted April 30, 2015 ah. ouch. I see. well… in my case I have a setup where I make a distinction between the place where the items are stored/edited and where they are displayed… - home -- News -- (article) (used for display) -- (rss) (used for the rss) ... - News-Admin (template=news) -- My News 1 (template=article) -- My News 2 (template=article) .... So I have the page "News" with urlSegment… /news/article/my-news-1/ which will display the correct news. so the item-link in the rss should be /news/article/{$item-name}… now, with the needed article.php (which is empty) in place, the link in the rss is /news-admin/my-news-1/ I simplified my set-up, in reality there's a lot more bundled under the "administration" page in the tree, not only "news-admin". hm. I think it will be easier to make the rss output by hand and not using the module, then EDIT: Thanks for the idea with the redirect on the item's template. Works like a charm for my set-up. Link to comment Share on other sites More sharing options...
isellsoap Posted May 26, 2015 Share Posted May 26, 2015 (edited) I’m using ryan’s RSS Feed Module and using the body field as Default Feed Item Description Field in the configuration. I have blog posts with images, and the image URLs are relative. The W3C Feed Validation Service suggests, that it would be better to always include absolute URLs. Long story short, how can I transform relative URLs from a textarea field into absolute ones? Edited May 26, 2015 by LostKobrakai Moved to support topic Link to comment Share on other sites More sharing options...
Aaron Czichon Posted June 29, 2015 Share Posted June 29, 2015 Hi there, I got that issue, that it always renders a "1" at the end of the feed. Feed outpu looks like: </item></channel></rss> 1 My PHP looks like this: // retrieve the RSS module $rss = $modules->get("MarkupRSS"); // find the pages you want to appear in the feed. // this can be any group of pages returned by $pages->find() or $page->children(), etc. $items = $home->children('template=post')->reverse()->find('start=6'); // send the output of the RSS feed, and you are done echo $rss->render($items); Thanks Link to comment Share on other sites More sharing options...
ngrmm Posted October 28, 2015 Share Posted October 28, 2015 (edited) i installed the module and used this in my template: $rss->title = "Latest updates"; $rss->description = "The most recent pages updated on my site"; $items = $pages->find("limit=10, sort=-modified"); $rss->render($items); now i'm getting an error for the last line: Error: Call to undefined method stdClass::render() (line 11 of /var/www/vhosts/***/httpdocs/tmp/site/templates/feed.php) Edited October 28, 2015 by kongondo Moved your topic to MarkupRSS support thread Link to comment Share on other sites More sharing options...
Macrura Posted October 28, 2015 Share Posted October 28, 2015 you would need to instantiate the class first, e.g. call the module into an object: $rss = $modules->get("MarkupRSS"); 2 Link to comment Share on other sites More sharing options...
ngrmm Posted October 28, 2015 Share Posted October 28, 2015 thanks Macrura i did an now this. sorry, but i don't know where that should be This page contains the following errors:error on line 46 at column 106: Attribute alt redefined Link to comment Share on other sites More sharing options...
Macrura Posted October 28, 2015 Share Posted October 28, 2015 that call would go right before your other settings; also make sure that your $items returns some pages 1 Link to comment Share on other sites More sharing options...
ro-bo Posted July 8, 2016 Share Posted July 8, 2016 Hi, in my new project there are some pages which are only included in an overview page by $page->render($options) and can not be shown as an independent page, I'll call them "sections". I'm using the limit-selector string and the pagination... Now I would like to refer to special sections which are split by a pagination--> e.g. RSS-link should look like this: domain.tld/sub/page3 Actually I solved it this way: rss.php template foreach ($items as $item) { $item_parent = $item->parent; if ($item->template == 'my-section-template') { $limit = 3; $children = $item_parent->children('sort=sort'); $item_pos = $children->getItemKey($item) + 1; $pagination_nr = ceil($item_pos / $limit); $item->httpURL_mod_wg = $item->parent->httpURL . 'page' . $pagination_nr; }//end if } module modification (the bad way, I know): protected function renderItem(Page $page) { .... if(!$page->httpURL_mod_wg) $page->httpURL_mod_wg = $page->httpUrl; // inserted by WG $out = "\t<item>\n" . "\t\t<title>$title</title>\n" . "\t\t<description><![CDATA[$description]]></description>\n" . $pubDate . $author . "\t\t<link>{$page->httpURL_mod_wg}</link>\n" . // $page->httpUrl modified to $page->httpURL_mod_wg "\n\t<guid>{$page->httpURL_mod_wg}</guid>\n" . // $page->httpUrl modified to $page->httpURL_mod_wg "\t</item>\n"; return $out; } It would be nice if there was a way to modify the <link> and <guide> urls for each Feed Item! Or maybe someone has a simple solution for this? Thanks Robert Link to comment Share on other sites More sharing options...
majake Posted October 20, 2016 Share Posted October 20, 2016 I've taken over a site from a developer and it's on processwire. I'm trying to activate RSS and I've followed the instructions but I keep getting this error: error on line 1 at column 1866: xmlParseEntityRef: no name I think maybe it's appending a header or footer and causing problems, but there is no checkbox in "files" so I'm not sure if that's the case. I used the exact code that's on the forum. From what I've read it might have to do with the "delayed loading" or _init.php file, but I can't identify the issue. Any help would be very much appreciated. The URL is: http://www.roofcoonline.com/rss/ Link to comment Share on other sites More sharing options...
Robin S Posted October 21, 2016 Share Posted October 21, 2016 Hi @majake and welcome to the PW forums. I haven't used this module before, but I think you're right about the problem being related to a "delayed output" strategy. There is probably a template file being auto-appended to your RSS template - typically this would be called "main.php", "main.inc" or something similar. The instruction to auto-append this template file will be in your site config: probably in the /site/config.php file unless your site is using the ProcessWire Config module that stores additional config settings in separate JSON file. If there is a template file being auto-appended you should see a checkbox to disable this for the RSS template: Setup > Templates > rss (or whatever your template is called) > Files tab 1 Link to comment Share on other sites More sharing options...
majake Posted October 21, 2016 Share Posted October 21, 2016 Hi Robin, thanks for the reply, this was my theory, but I do not have the disable automatic append checkbox in the template files tab. I've also looked at the config file and there are no append lines. Where else would you look? Link to comment Share on other sites More sharing options...
Robin S Posted October 21, 2016 Share Posted October 21, 2016 @majake - I suggest you remove the config info in your previous post for the sake of security. You don't want to be posting your DB username/pass etc in a public forum. A couple of other ways that "main.php" might be appended: 1. The file is pulled in with an include in your RSS template. Probably not as I expect you would have noticed this. 2. It would be unusual, but I suppose the file could be appended in a hook. So you could try this: In your RSS template, insert this: <?php $no_main = true; ?> And at the first line of "main.php" (or whatever the file is called that contains your header/footer markup): <?php if(isset($no_main) && $no_main) return; ?> Edit: actually, could you post the contents of your RSS template file? That will help get to the bottom of the problem. 1 Link to comment Share on other sites More sharing options...
majake Posted October 21, 2016 Share Posted October 21, 2016 I'm not actually sure where the header/footer data resides. I don't have a main.php... The RSS template file was copied directly from this thread: <?php // retrieve the RSS module $rss = $modules->get("MarkupRSS"); // configure the feed. see the actual module file for more optional config options. $rss->title = "Latest updates"; $rss->description = "The most recent pages updated on my site"; // find the pages you want to appear in the feed. // this can be any group of pages returned by $pages->find() or $page->children(), etc. $items = $pages->find("limit=10, sort=-modified"); // send the output of the RSS feed, and you are done $rss->render($items); Link to comment Share on other sites More sharing options...
Robin S Posted October 21, 2016 Share Posted October 21, 2016 @majake I did a bit of sleuthing and I think your website may be using the Spex module.http://modules.processwire.com/modules/spex/ I don't think this module is very widely used (it doesn't come up often in the forum) so there may not be many members here who can help you with it. But check out the links above and that may point you in the right direction. One more thing - your site seems to already have an RSS feed with the same content you are trying to output: http://www.roofcoonline.com/blog/rss 2 Link to comment Share on other sites More sharing options...
majake Posted October 21, 2016 Share Posted October 21, 2016 Hi Robin, Thanks for the info. I hadn't actually wasn't aware of the existing RSS feed and I'm not sure where it resides. What I'm really trying to do is syndicate new blog posts to Twitter automatically with a link back to the full post. On Wordpress I can do this with IFTTT and use the RSS feed as the trigger channel, but the existing RSS feed isn't formatted for syndication and doesn't have an attribution link back to the main post. Any ideas for a better way to achieve the end goal? Link to comment Share on other sites More sharing options...
Peter Falkenberg Brown Posted March 18, 2018 Share Posted March 18, 2018 Hi Ryan and Team, I'm using the module "RSS Feed Generator" v1.0.2, in PW 3.0.42. (I'm going to upgrade when 3.1 comes out.) I just noticed that my rss feed here: http://significatojournal.com/rss/ doesn't display anything in Chrome (but works in Firefox). (The source xml is being generated.) I also saw that Chrome requires an RSS extension to display RSS: https://chrome.google.com/webstore/detail/rss-feed-reader/pnjaodmkngahhkoihejjehlcdlnohgmp?hl=en so I installed it, but still nothing. I then went to the NY Times and saw that their feed worked in Chrome *if* the extension was installed. I compared the raw xml at the NY Times against the raw xml in my feed, and saw a significant difference. However, since the xml is generated by the module, I didn't really want to mess with it. Here are the two snippets from the headers. (The rss tree looks similar -- it's just the first set of declarations that look different.) RSS FEED GENERATOR AT SIGNIFICATOJOURNAL.COM: <?xml version='1.0' encoding='utf-8' ?> <?xml-stylesheet type='text/xsl' href='/site/templates/styles/rss_feed.xsl' ?> <rss version='2.0' xmlns:dc='http://purl.org/dc/elements/1.1/'> NY TIMES FEED: <rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:nyt="http://www.nytimes.com/namespaces/rss/2.0" version="2.0"> I believe that the module should be modified, for Chrome support. Any thoughts? Thanks! Peter Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now