vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Chooseable External Output (https://vborg.vbsupport.ru/showthread.php?t=68815)

Slynderdale 08-27-2004 10:00 PM

Chooseable External Output
 
If you have External data enabled in the options, you can have xml and rss feeds for your forums. By default, the ost previews strip all bbcodes and only show portions of the text. This hack lets you choose how you want the output to be like.

The bbcode, smiles, and html output depends on the forum settings of that post.

The choices are:
Default: Short preview with no BBcodes.
1: Full text with no bbcodes
2: Full text with bbcodes

These can be selected via the browser query string.
Example:
http://www.yourforum.com/external.ph...=RSS2&format=2

In forum/root/external.php find:
PHP Code:

  $permissions cache_permissions($bbuserinfo); 

under it add:
PHP Code:

  $format iif($_GET['format'],intval($_GET['format']),0); 

then find:
PHP Code:

 echo "\t\t<content:encoded><![CDATA["htmlspecialchars_uni(fetch_trimmed_title(strip_bbcode($thread['preview'], falsetrue), $vboptions['thread'])) ."]]></content:encoded.\r\n"

and replace it with:
PHP Code:

          if (function_exists('format_external_text'))
          {
          
$thread['preview'] = format_external_text($thread['preview'],$format,$thread['forumid']);
          }
          else
          {
          
$thread['preview'] = htmlspecialchars_uni(fetch_trimmed_title(strip_bbcode($thread['preview'], falsetrue)));
          }
              echo 
"\t\t<content:encoded><![CDATA["$thread['preview'] ."]]></content:encoded>\r\n"

If you have the PHP external feed hack installed;
Found here: https://vborg.vbsupport.ru/showthread.php?t=59575

Find:
PHP Code:

  else if ($_REQUEST['type'] == 'PHP')
  { 
// PHP output 

and under it add:
PHP Code:

    foreach ($threadcache AS $key => $thread)
    {
      if (
function_exists('format_external_text'))
      {
        
$thread['preview'] = format_external_text($thread['preview'],$format,$thread['forumid']);
      }
      else
      {
      
$thread['preview'] = htmlspecialchars_uni(fetch_trimmed_title(strip_bbcode($thread['preview'], falsetrue)));
      }
      
$threadcache[$key]['preview'] = $thread['preview'];
    } 

close and save external.php

Now in file forum/root/includes/functions_external.php find:
PHP Code:

  ?> 

and above it add:
PHP Code:

  function format_external_text($text,$format,$forumid=0) {
    
$format intval($format);
    
$forumid intval($forumid);
    if (
$format<=0)
    {
      
$text htmlspecialchars_uni(fetch_trimmed_title(strip_bbcode($textfalsetrue)));
    }
    else if (
$format == 1)
    {
      
$text htmlspecialchars_uni(strip_bbcode($textfalsetrue));
    }
    else
    {
      require_once(
'./includes/functions_bbcodeparse.php');
      
$text parse_bbcode($text,$forumid);
    }
    return 
$text;
  } 

Thats all.

johnnyb 08-28-2004 10:54 PM

Thanks! :)

newmomsforum 09-23-2007 12:54 AM

Hi, should this work for the latest release as I'm looking for something that will output the full text of the post via rss not just a preview? :)


All times are GMT. The time now is 05:57 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01089 seconds
  • Memory Usage 1,743KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete