logo

$10
How to get sidebar items from another database?

I have a site running WordPress. However, there is some info about products I am selling, where the information about the products needs to be drawn from another database (not the WordPress database). Does anyone have any code, or a plugin, that would let me pull in some sidebar items from another database?

marshall | 05/02/10 at 9:07pm | Edit


(6) Possible Answers Submitted...

  • avatar
    Last edited:
    05/18/10
    12:38am
    Lew Ayotte says:

    Do you have access to the database?

    You can use PHP/WP to access the database and pull the values you need.

    I had a similar issue access Pinnacle Cart from WordPress a few weeks ago... this was the code I used:

    global $template,$wp_query; 

    if ( is_front_page() ) {
    $pinn_db = new wpdb(DB_USER, DB_PASSWORD, 'saddle_pinn', DB_HOST);

    $querystr = "SELECT DISTINCT url_default, name
    FROM catalog c
    WHERE c.parent = 0
    AND is_visible LIKE 'Yes' ";
    $pinn_cats = $pinn_db->get_results($querystr, OBJECT);

    foreach ($pinn_cats as $pinn_cat) {
    echo "<li><a href='/store/" . $pinn_cat->url_default . "' title='". $pinn_cat->name . "'>" . $pinn_cat->name . "</a>" . "</li>";
    }


    Lew

  • avatar
    Last edited:
    05/02/10
    10:00pm
    No Mind says:

    You can use the plugin WP Custom Widget to add PHP code in your sidebar.
    http://wordpress.org/extend/plugins/wp-custom-widget/

  • avatar
    Last edited:
    05/03/10
    3:30am
  • avatar
    Last edited:
    05/04/10
    6:51am
    WPMan says:

    Use "bluesome.net/data/2005/08/exec-php.zip" and add your PHP code to post/pages/sidebar.


    Eg.


    <?php
    include('/path/to/database/connection.php');
    ?>

  • avatar
    Last edited:
    05/04/10
    12:20pm
    Andrzej Zglobica says:

    I believe you might be asking for more detailed advice, some specific query code? - this depends on the stucture of the database you want to pull data from and some other circumstances. I guess this task might require more budget, just in case you might contact me so I can help you choose the proper solution: http://www.wpquestions.com/user/contact/id/530

  • avatar
    Last edited:
    05/04/10
    1:09pm
    Samuel Arendt says:

    idem,

    http://wpquestions.com/user/profile/id/833

This question has expired.





Current status of this question: Completed