Forum Replies Created

Viewing 15 replies - 1 through 15 (of 24 total)
  • Thread Starter antishape

    (@antishape)

    I have this code now:
    [Code moderated as per the Forum Rules. Please use the pastebin]

    I get the following error message:
    Catchable fatal error: Object of class stdClass could not be converted to string

    I tried the following, the try you see above is the last one, before that I tried:
    echo '<li><strong>' . htmlspecialchars((string)$tag) . '</strong>: ' . getWikiIntroParagraph( $tag->name );

    and

    echo '<li><strong>' . htmlentites((string)$tag) . '</strong>: ' . getWikiIntroParagraph( $tag->name );

    Don’t know what happened. Even if I put
    echo $tag;

    before the line, I got no result and the same error message. Any ideas?

    Thread Starter antishape

    (@antishape)

    Thanks. Had a look at the page before I posted here. but didn’t recognize the PHP-array-function:
    https://php.net/manual/de/language.types.array.php

    And even if it has the same function I don’t know how to use it nor do I think it could work out like it should. Means: I need to use get_the_tags, via arrays I need to seperate them and then – maybe with foreach – process every single tag and put the $singletag into an url, for example:
    https://www.foo.org/foo?$singletag/somename
    and than I need to use strip_tags on what I get from the URL and then display it via echo / print.

    I have no clue at all how to do it. But I heard it isn’t that difficult. You use, I need code or more exact instructions what I need for this and furthermore help if I doesn’t get it the right way. I don’t know how to use all the stuff to get it the right way. Only thing I knew is to start php code and end it and do some echo / print things. If it comes to functions, brackets and whatever I am lost. So any further help and step(s)-by-step instruction are more then welcome.

    Thread Starter antishape

    (@antishape)

    Ok now I don’t just add the_tags instead of Pink Floyd I did this:

    $ptags = the_tags();

    and put it in place instead of Pink Floyd. But doesn’t change anything. OK it will be displayed but the same way as Tags usually will be displayed not as a wikibox.

    So now it looks like:
    <?php if ( function_exists( ‘wikibox_summary’ ) ) wikibox_summary( ‘$ptags’ ); ?>

    But doesn’t help me.

    Anyone? Please!?

    Thread Starter antishape

    (@antishape)

    I am now using the wikibox plugin and via shortcode I could put every summary in the post I like but I still need it automatically because there already over 1000 posts in the blog and it won’t be great to extend them all manually.

    So I need an alternative version. Great. This code allows me to get a summary for the wikipedia article of Pink Floyd:
    <?php if ( function_exists( 'wikibox_summary' ) ) wikibox_summary( 'Pink Floyd' ); ?>

    If I put the_tags in the same place as Pink Floyd (instead of Pink Floyd) I don’t get anything. Not even an error message. Do have any idea how to handle this even if there are more tags than one?

    Thread Starter antishape

    (@antishape)

    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 https://en.wikipedia.org/tagone, https://en.wikipedia.org/tagtwo etc.
    and display it one after another

    Tagone

    Tagtwo

    etc.

    Thread Starter antishape

    (@antishape)

    Thread Starter antishape

    (@antishape)

    <?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 'https://de.wikipedia.org/w/index.php?'.$query;
    ob_end_flush();
    }
    print( '<small><p>
    Text und Bilder dieses Beitrags stammen aus dem Artikel
    <a href="https://de.wikipedia.org/wiki/'.$begriff.'" title="https://de.wikipedia.org/wiki/'.$begriff.'" target="_blank">'.$search.'</a>
    der freien Enzyklop&auml;die <a href="https://de.wikipedia.org" title="https://de.wikipedia.org" target="_blank">Wikipedia</a>
    und stehen unter der <a href="https://www.gnu.org/licenses/fdl.txt" target="_blank">GNU Free Documentation License</a>.
    Die Liste der Autoren ist in der Wikipedia unter
    <a href="https://de.wikipedia.org/w/wiki.phtml?title='.$search.'&action=history" target="_blank" title="https://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="https://de.wikipedia.org/w/wiki.phtml?title='.$search.'&action=edit" target="_blank" title="hierhttps://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?

    Is it possible to get automatical output based on tags used in a post? I mean, each individual post gets automatically its wiki summaries based on the tages used. It must be summaries only (up to maximum 250 words, better 100-150 words), it should be in neat “boxes” between boxes should be at least two br-tags or one <p>-tag. Would be great if I just need to code to single.php so rest is automatically without adding shortcode in the post / page.

    Thread Starter antishape

    (@antishape)

    This is the code – i guess – that need the plugin WP-Wikibox to get summary from wikipedia.
    https://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?

    Thread Starter antishape

    (@antishape)

    Thanks a lot!

    Thread Starter antishape

    (@antishape)

    Thank you! Guess it was confusing to see $catid instead of ‘catid’ so I thought it would be wrong to place it here.

    Thread Starter antishape

    (@antishape)

    Sure, mark it right away.

    One more thing if you don’t mind: order by post title possible?

    Thread Starter antishape

    (@antishape)

    I see. The problem was a plugin named Ultimate Category Excluder. Thanks a lot. Runs fine.

    Thread Starter antishape

    (@antishape)

    If it’s the same slug WP stops me from creating another one, I need to add a number manually. But I can’t see a solution for my problem. Maybe more posts?

    Thread Starter antishape

    (@antishape)

    And, by the way does it matter if the both page and category aren’t visible for visitors but still published? They’re just excluded from the menu.

Viewing 15 replies - 1 through 15 (of 24 total)