Marcher Technologies Posted September 22, 2012 Share Posted September 22, 2012 File Name: Tagged Data Feeds File Submitter: Marcher Technologies File Submitted: 21 Sep 2012 File Category: Content Management Supported Versions: IP.Content 2.3.x This Feed source will allow you to pull feeds of data based on Tags from various applications, including Blog Entries, Downloads Files, Forums Topics, Gallery Images, Tutorials Articles, IP.Content Articles, and Database Records.All stock configurations for said feed sources are present and honoured. If the user is currently viewing an item tagged the same for the same content type(databases are each unique content types), the item will be excluded from the result set. Feed Block Templates for the specific content types proxy to the corresponding correct stock template type(Database Records, IPContent Articles, Tutorials Articles, Gallery Images, Forum Topics, and Downloads Files), allowing re-use of existing templates pulling same-tagged data easily. Input from request Value for tags to show is supported with the @ prefix on all Content Types. Demo can be seen at page top here(the scrolling Articles template is not included, is merely a showing of this feeds template re-usage). Supported Non-Content Applications Versions: IP.Board 3.3.x+, IP.Gallery 5.x+, IP.Downloads 2.5.x+, Tutorials 1.4.3+ Required Minimum Content Version: IP.Content 2.3.2 here to download this file Link to comment Share on other sites More sharing options...
Jinkler Posted September 23, 2012 Share Posted September 23, 2012 Demo: http://www.fordbay.c...page/index.html That page shows you three blocks, each of which the content has been pulled from the tag attached to each topic (I'm using Ryan's Tagging system). Link to comment Share on other sites More sharing options...
sound Posted September 25, 2012 Share Posted September 25, 2012 reading the above not sure if does what am after so asking do the feeds available allow display of tags in one feed across all the content types as in you can have just one feed block showing all gallery, forum and ipcontent items tagged say "software" Link to comment Share on other sites More sharing options...
Marcher Technologies Posted September 25, 2012 Author Share Posted September 25, 2012 reading the above not sure if does what am after so asking do the feeds available allow display of tags in one feed across all the content types as in you can have just one feed block showing all gallery, forum and ipcontent items tagged say "software" This would actually be an act of resource insanity... A: would have to loop through every installed app supporting tags. B: would then need to load each tags class if not loaded(for content, this is every database). C: would then have to pull the configured limit for each tags class, no other filtering could be applied. D: would then need to sort through combining and limiting the array, checking permissions there by app, and grabbing the correct data for the app from rand table 'x'. dunno HOW i'd swing this btw, as i'm grabbing the *actual* *items* that were tagged and honouring perms in a join in the tags api search call to limit resource usage.... in short, no. It will pull all said items, and with native additional filtering, but all in one block would be heavy, *extremely* so, a nightmare to maintain, and extremely limited in configuration. You also would be stuck using only generic feed templates rather than the plethora of by-app block templates available. Link to comment Share on other sites More sharing options...
sound Posted September 25, 2012 Share Posted September 25, 2012 This would actually be an act of resource insanity... A: would have to loop through every installed app supporting tags. B: would then need to load each tags class if not loaded(for content, this is every database). C: would then have to pull the configured limit for each app, no other filtering could be applied. D: would then need to sort through combining and limiting the array, checking permissions there by app, and grabbing the correct data for the app from rand table 'x'. dunno HOW i'd swing this btw, as i'm grabbing the *actual* *items* that were tagged in a join in the tags api search call to limit resource usage.... in short, no. ok thanks for the reply as said was just wondering thanks Link to comment Share on other sites More sharing options...
Tigratrus Posted April 18, 2013 Share Posted April 18, 2013 Can you give us an example of an invocation of this block in a DB display template to use the DB record title as the tag to pull for the feed? I.E. We have @input set for the "Filter By Tags" on the Filters step of the block wizard. We have an IP.C DB that has a record for each tag in our closed tagging system, where the DB record title == Pre-defined tag value. This will allow us to build a landing page for each subject/tag that acts as a content aggregator with a writeup about the particular subject, some links and reference materials, sponsorship options for the page etc and then a set of these blocks below to show the most viewed content of various types on the site that are related to the subject(associated via tag). Hope that makes sense? :) Thanks in advance for any assistance you can provide. James Link to comment Share on other sites More sharing options...
Tigratrus Posted April 29, 2013 Share Posted April 29, 2013 Ping? James Link to comment Share on other sites More sharing options...
Marcher Technologies Posted April 30, 2013 Author Share Posted April 30, 2013 This... I will have to think on. We discussed(via IM) that it would certainly be more sane to show same-tagged content with a hook already doing the job exactly(that exists), but the desire to pro-grammatically control the pull is not something I cannot scoff at, the issue becomes one of execution ordering... something I discovered when trying to 'setup' request data for feeds.... I think I will end up sniffing 'settings' as well at this point. Likely with something different than @ though for clarity. Link to comment Share on other sites More sharing options...
kotaco Posted May 2, 2013 Share Posted May 2, 2013 So if I wanted to display anything with matching tags to the article, what would my input for the filter have to be? @tags? Or would I have to add something to the article template to identify the tags? Link to comment Share on other sites More sharing options...
Marcher Technologies Posted May 2, 2013 Author Share Posted May 2, 2013 So if I wanted to display anything with matching tags to the article, what would my input for the filter have to be? @tags? Or would I have to add something to the article template to identify the tags? The problem is one of execution order, having a go at it myself.... but getting fairly certain lib hook is only way to set it up proper. Link to comment Share on other sites More sharing options...
kotaco Posted May 2, 2013 Share Posted May 2, 2013 The problem is one of execution order, having a go at it myself.... but getting fairly certain lib hook is only way to set it up proper. Ah, I see I'm not the first to question that then. Well no hurry, I'll await any updates as they come if/when they do. In the meantime I do have it setup and running just fine as the "Related News" articles below the main test article using some predefined tags:http://www.emergencybricks.com/article.html/_/test-categor/test-article-123-r22 Very easy install, working as described :) Link to comment Share on other sites More sharing options...
Tigratrus Posted June 11, 2013 Share Posted June 11, 2013 Did we ever come to a solution for this? I'm trying to build aggregator pages that will show blocks of various content types/IP.C DBs that have been tagged with a given value, so there is a landing page that shows a recent stream of everything going on with a given tag. I REALLY don't want to have to build individual pages for every tag AND individual feed blocks for each content type AND for each tag. ::shudder:: There must be an easier way? Puhlease? : James Link to comment Share on other sites More sharing options...
kotaco Posted July 5, 2013 Share Posted July 5, 2013 Did we ever come to a solution for this? I'm trying to build aggregator pages that will show blocks of various content types/IP.C DBs that have been tagged with a given value, so there is a landing page that shows a recent stream of everything going on with a given tag. I REALLY don't want to have to build individual pages for every tag AND individual feed blocks for each content type AND for each tag. ::shudder:: There must be an easier way? Puhlease? : James I was just thinking the same recently Link to comment Share on other sites More sharing options...
Marcher Technologies Posted July 6, 2013 Author Share Posted July 6, 2013 I was just thinking the same recently I got to playing with it. /code $blockKey = 'tags'; $tags = 'duschdor'; $output = ''; $theFile = IPSLib::getAppDir('ccs') . '/extensions/content/feed_blocks/tags_feed.php'; if(file_exists($theFile) && isset($this->caches['ccs_blocks'][$blockKey])) { $config =& $this->caches['ccs_blocks'][$blockKey]; if(IPSLib::isSerialized($config['block_config'])) { $config['block_config'] = IPSLib::safeUnserialize($config['block_config']); } $config['block_config']['tags'] = $tags; $config['block_config'] = @serialize($config['block_config']); require_once( IPSLib::getAppDir( 'ccs' ) . '/sources/blocks/feed/feedInterface.php' );/*noLibHook*/ $classToLoad = IPSLib::loadLibrary($theFile, 'feed_tags_feed', 'ccs'); $obj = new $classToLoad($this->registry); $output .= $obj->executeFeed($config); } print $output; The above will work in a raw PHP block, or on a raw PHP page where a block has parsed before the code, say in a page template or with php. $blockKey needs to be an actual tagged data feed block key, $tags is where you can dynamically force tags for the given instance to use. If no blocks have parsed before, you will need to add this to the top of the above code: if( !$this->caches['ccs_blocks'] ) { $blocks = array(); $this->DB->build( array( 'select' => 'b.*', 'from' => array( 'ccs_blocks' => 'b' ), 'where' => 'b.block_active=1', 'add_join' => array( array( 'select' => 't.tpb_name', 'from' => array( 'ccs_template_blocks' => 't' ), 'where' => 't.tpb_id=b.block_template', 'type' => 'left', ), ) ) ); $this->DB->execute(); while( $r = $this->DB->fetch() ) { $blocks[ $r['block_key'] ] = $r; } $this->cache->updateCacheWithoutSaving( 'ccs_blocks', $blocks ); } If in a database, articles page template, you will need to wrap the code with <php></php> tags, and remove the 'print $output;' statement, and instead use {$output} after the closing </php> tag. The above is customized code to allow one to reuse the feed source with this modification in more dynamic ways, while still allowing a base set of configurations to reuse. As you can see it is a trifle to change the content type dynamically as well, however in doing so one would need to specify a feed template by key from the template gallery to use in the $config array, as the template the block is configured to use would be invalid for a different content type. I don't see a proper way to implement this flexibility pre-made unfortunately, so a working code sample will have to do. :smile: Link to comment Share on other sites More sharing options...
Tigratrus Posted July 18, 2013 Share Posted July 18, 2013 Do we know that this is definitively working? I've got it all set up, and it seems to be rendering the block but it's NOT using the tag supplied in the DB Display template, it's rendering the tag block with whatever is set in the block 'Filter By Tags' value. :: puzzled :: I get the feeling it's REALLY close to working as it IS generating the block, but something's not quite right. Here's the code inserted just above the foreach loops in the display template: <php> if( !$this->caches['ccs_blocks'] ) { $blocks = array(); $this->DB->build( array( 'select' => 'b.*', 'from' => array( 'ccs_blocks' => 'b' ), 'where' => 'b.block_active=1', 'add_join' => array( array( 'select' => 't.tpb_name', 'from' => array( 'ccs_template_blocks' => 't' ), 'where' => 't.tpb_id=b.block_template', 'type' => 'left', ), ) ) ); $this->DB->execute(); while( $r = $this->DB->fetch() ) { $blocks[ $r['block_key'] ] = $r; } $this->cache->updateCacheWithoutSaving( 'ccs_blocks', $blocks ); } $blockKey = 'Article_tags_feed'; $tags = 'Cancer'; $output = ''; $theFile = IPSLib::getAppDir('ccs') . '/extensions/content/feed_blocks/tags_feed.php'; if(file_exists($theFile) && isset($this->caches['ccs_blocks'][$blockKey])) { $config =& $this->caches['ccs_blocks'][$blockKey]; if(IPSLib::isSerialized($config['block_config'])) { $config['block_config'] = IPSLib::safeUnserialize($config['block_config']); } $config['block_config']['tags'] = $tags; $config['block_config'] = @serialize($config['block_config']); require_once( IPSLib::getAppDir( 'ccs' ) . '/sources/blocks/feed/feedInterface.php' );/*noLibHook*/ $classToLoad = IPSLib::loadLibrary($theFile, 'feed_tags_feed', 'ccs'); $obj = new $classToLoad($this->registry); $output .= $obj->executeFeed($config); } </php> {$output} Link to comment Share on other sites More sharing options...
Tigratrus Posted July 18, 2013 Share Posted July 18, 2013 When I go in and put some plants below the output to try and show what the result array wise is, like so: {$output}<br/> Tags:{$tags}<br/> Config:{$config['block_config']['tags']} I get: Tags:Cancer Config:a What the heck? Any ideas? James Link to comment Share on other sites More sharing options...
Marcher Technologies Posted July 18, 2013 Author Share Posted July 18, 2013 $config['block_config'] is a serialized string representation of an array at the point you are trying to dump it.... PHP is converting the invalid string array key 'tags' to 0 to represent a valid string byte offset for array access and displaying the character at said string byte offset, which is 'a'. Yes, I did test this, it is working, will debug this with you through skype. Link to comment Share on other sites More sharing options...
kotaco Posted August 1, 2013 Share Posted August 1, 2013 I'll have to give this a try *note to self: back up site :P * Link to comment Share on other sites More sharing options...
Tigratrus Posted August 17, 2013 Share Posted August 17, 2013 Awesome. Awesome. Awesome. Just wanted to thank Marcher for his help on this one. It's working perfectly once we made one minor (but necessary) tweak to the example above. Note that this tweak applies to both my specific implementation example as well as the original snippet Marcher posted above. It's also worth noting that my example also had the Tags value hard coded for testing, in production we want to have the block show content where the tag matches the title of the page showing the block to create tag "Landing Pages". In this case, to accomplish that: $tags = count($words)?implode(', ', $words):''; Was used. I would have thought:$tags = $data['record'][$data['database']['database_field_title'] . '_value' ] would make more sense, but I'm not about to argue with success. :) Anyway, the tweak needed was: $config['block_config']['tags'] = $tags; Needed to be: $config['block_config']['filters']['tags'] = $tags; Once he made that tweak while we chatted about it on skype it all worked! Amazing what you can do with this! I think I've already got another use planned as well as the original one. Thanks! James Link to comment Share on other sites More sharing options...
Tigratrus Posted August 29, 2013 Share Posted August 29, 2013 BUG! Took me a while to track this one down. Using the (AMAZING!) dynamic tag feed block functionality above, when used in a DB display template the tag feed will NOT show a record from a different DB that has the same id as the one you are viewing. It's actually there in the SQL query itself as a specific exclusion. For example, if I have a "Condition" IP.C custom DB where record id # 3 is "Diabetes" and I have a dynamic tag feed block showing records from the "Ingredients" IP.C custom DB, any "Ingredient" record tagged with "diabetes" will show up in the tag feed as it should EXCEPT the "Ingredient" record id # 3. The SQL query generated for the tag feed in question is: SELECT tg.* ,r.* FROM core_tags tg LEFT JOIN ccs_custom_database_4 r ON (r.primary_id_field=tg.tag_meta_id AND r.category_id IN(20,21,23,39,40,24,41,22,42,43)) WHERE tg.tag_meta_app='ccs' AND tg.tag_meta_area='records-4' AND tg.tag_meta_id !=3 AND tg.tag_text IN ('diabetes') AND tg.tag_aai_lookup IN (SELECT tag_perm_aai_lookup FROM core_tags_perms WHERE ( ( FIND_IN_SET(4,tag_perm_text) ) OR ( tag_perm_text='*' ) ) AND tag_perm_visible=1 ) ORDER BY r.record_saved desc LIMIT 0,3 Note the section AND tg.tag_meta_id !=3 in the SQL above. Same issue if you are viewing "Condition" record id # 1 except there it's: AND tg.tag_meta_id !=1 Beat my head against the keyboard for quite a bit trying to see what in the tags DB structure wasn't working right until I thought to throw it into full on debug level and look through the generated queries... I'm slow that way sometimes. :tongue: On the upside, I now know one HECK of a lot more about how the tag system DB tables store things now! :lol: And for anyone else looking to grok the functions of the tag_meta_XXXXXX columns in the core_tags table I found http://www.invisionpower.com/support/guides/_/advanced-and-developers/application/application-extension-tags-r212 to be quite helpful as a rosetta stone. Anyway, this isn't something I can fix on my own, help? Pretty please? With pizza on top? :) James P.S. Just wanted to mention, that the dynamic tag feed method illustrated in this support topic is a really cool insight into the way the block system works behind the scenes. I can easily see leveraging the same technique to do other dynamic blocks should the need arise. :drool: Link to comment Share on other sites More sharing options...
Marcher Technologies Posted August 29, 2013 Author Share Posted August 29, 2013 BUG! Took me a while to track this one down. Using the (AMAZING!) dynamic tag feed block functionality above, when used in a DB display template the tag feed will NOT show a record from a different DB that has the same id as the one you are viewing. It's actually there in the SQL query itself as a specific exclusion. For example, if I have a "Condition" IP.C custom DB where record id # 3 is "Diabetes" and I have a dynamic tag feed block showing records from the "Ingredients" IP.C custom DB, any "Ingredient" record tagged with "diabetes" will show up in the tag feed as it should EXCEPT the "Ingredient" record id # 3. The SQL query generated for the tag feed in question is: SELECT tg.* ,r.* FROM core_tags tg LEFT JOIN ccs_custom_database_4 r ON (r.primary_id_field=tg.tag_meta_id AND r.category_id IN(20,21,23,39,40,24,41,22,42,43)) WHERE tg.tag_meta_app='ccs' AND tg.tag_meta_area='records-4' AND tg.tag_meta_id !=3 AND tg.tag_text IN ('diabetes') AND tg.tag_aai_lookup IN (SELECT tag_perm_aai_lookup FROM core_tags_perms WHERE ( ( FIND_IN_SET(4,tag_perm_text) ) OR ( tag_perm_text='*' ) ) AND tag_perm_visible=1 ) ORDER BY r.record_saved desc LIMIT 0,3 Note the section AND tg.tag_meta_id !=3 in the SQL above. Same issue if you are viewing "Condition" record id # 1 except there it's: AND tg.tag_meta_id !=1 Beat my head against the keyboard for quite a bit trying to see what in the tags DB structure wasn't working right until I thought to throw it into full on debug level and look through the generated queries... I'm slow that way sometimes. :tongue: On the upside, I now know one HECK of a lot more about how the tag system DB tables store things now! :lol: And for anyone else looking to grok the functions of the tag_meta_XXXXXX columns in the core_tags table I found http://www.invisionpower.com/support/guides/_/advanced-and-developers/application/application-extension-tags-r212 to be quite helpful as a rosetta stone. Anyway, this isn't something I can fix on my own, help? Pretty please? With pizza on top? :smile: James P.S. Just wanted to mention, that the dynamic tag feed method illustrated in this support topic is a really cool insight into the way the block system works behind the scenes. I can easily see leveraging the same technique to do other dynamic blocks should the need arise. :drool: fixed, just re-download, unzip and re-upload the feed source. Link to comment Share on other sites More sharing options...
Tigratrus Posted August 29, 2013 Share Posted August 29, 2013 Awesome. You rock! :) That seems to have nailed it. James Link to comment Share on other sites More sharing options...
Graphite Posted January 20, 2014 Share Posted January 20, 2014 So... Is purchasing this mod the only way I can make blocks with the tags I use in IPC articles? Link to comment Share on other sites More sharing options...
Graphite Posted January 21, 2014 Share Posted January 21, 2014 Sorry to double post. Bought your plugin and it seems to work well. One issue I have though is that I get two less results than my block's limit. So if I set it to fetch 10 results it displays 8. Help on that would be appreciated. Also have a lonely radio button now with no title and no description when I choose a 'Feed' type block. Appeared after I installed your plugin. Link to comment Share on other sites More sharing options...
Marcher Technologies Posted February 14, 2014 Author Share Posted February 14, 2014 Sorry to double post. Bought your plugin and it seems to work well. One issue I have though is that I get two less results than my block's limit. So if I set it to fetch 10 results it displays 8. Help on that would be appreciated. Also have a lonely radio button now with no title and no description when I choose a 'Feed' type block. Appeared after I installed your plugin. Hello, Can you please follow up on the PM I just sent you? Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.