WordPress.org

Ready to get started?Download WordPress

Forums

how to get wiki-summary based on tags? (4 posts)

  1. antishape
    Member
    Posted 2 years ago #

    I am trying WP_Wikibox Plugin but doesn't like to have another idea. Is it possible to add code in single.php to get a summary - let's say 250 words - automatically based on the post's tags? It should display "boxes" between every box should be a br-tag or p-tag. Any ideas?

  2. antishape
    Member
    Posted 2 years ago #

    This is the code - i guess - that need the plugin WP-Wikibox to get summary from wikipedia.
    http://pastebin.com/HR8A9pkr

    How to change it to my needs?
    -Only get 100, 200 or 250 words of the article.
    -get tags from my post, get wiki articles' summary
    -do linebreak (br or p) and then add the next summary from a tag if there's one.
    -should be displayed in boxes.

    Any ideas?

  3. antishape
    Member
    Posted 2 years ago #

    <?php
    $query = $_SERVER['QUERY_STRING'];
    $search = $_GET['search'];
    ?>
    <h1><?php if (isset($search)) echo $search; ?></h1>
    
    function callback( $puffer ) { 
    
    $puffer = substr( $puffer, strpos( $puffer, '<!-- start content -->' ) );
    $puffer = substr( $puffer, 0, strpos( $puffer, '<div class="printfooter">' ) );
    $puffer = str_replace( "/w/index.php", "/wikipedia/wikistatic.php", $puffer );
    $puffer = str_replace( "/wiki/", "/wikipedia/wikistatic.php?title=Spezial:Search&search=", $puffer );
    $puffer = '<style>.editsection {display:none;}</style>'.$puffer;
    ($puffer);
    return $puffer;
    }
    if(eregi("Spezial:Search",$query) or eregi("Spezial%3aSearch",$query) or eregi("Special:Search",$query)) {
    $search = str_replace( " ", "+", $search );
    ob_start("callback");
    include 'http://de.wikipedia.org/w/index.php?'.$query;
    ob_end_flush();
    }
    print( '<small><p>
    Text und Bilder dieses Beitrags stammen aus dem Artikel
    <a href="http://de.wikipedia.org/wiki/'.$begriff.'" title="http://de.wikipedia.org/wiki/'.$begriff.'" target="_blank">'.$search.'</a>
    der freien Enzyklop&auml;die <a href="http://de.wikipedia.org" title="http://de.wikipedia.org" target="_blank">Wikipedia</a>
    und stehen unter der <a href="http://www.gnu.org/licenses/fdl.txt" target="_blank">GNU Free Documentation License</a>.
    Die Liste der Autoren ist in der Wikipedia unter
    <a href="http://de.wikipedia.org/w/wiki.phtml?title='.$search.'&action=history" target="_blank" title="http://de.wikipedia.org/w/wiki.phtml?title='.$search.'&action=history">dieser Seite</a> verf&uuml;gbar, der Original-Artikel l&auml;sst sich
    <a href="http://de.wikipedia.org/w/wiki.phtml?title='.$search.'&action=edit" target="_blank" title="hierhttp://de.wikipedia.org/w/wiki.phtml?title='.$search.'&action=edit">hier</a>
    bearbeiten.
    </p></small>');
    ?>

    This is code I found. Now I'd like to know how to modify it to get the results I want. Summary of 100-150 words, based on tags - all of this automatically.

    Any ideas?

  4. antishape
    Member
    Posted 2 years ago #

    Is it possible to get tags one after another and process one after another with file() to readout the article(s) like get 100-150 words from http://en.wikipedia.org/tagone, http://en.wikipedia.org/tagtwo etc.
    and display it one after another

    Tagone

    ---

    Tagtwo

    ---

    etc.

Topic Closed

This topic has been closed to new replies.

About this Topic