• Resolved rforster

    (@rforster)


    Hi All,

    This might be an advanced question but I’d like to connect to database on my site that generates lists. Used to use it on my site before I switched to WP.

    I tried to use some code inside the code tags in a new page I made but the page showed my code rather than running the code. My old pages were a body tag, include my header, run my script for my list, include my footer, close body.

    Can someone point me to reference here? Been searching but a lot of the topics get complicated fast. Thanks for any help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Why not just add your code to a Page template? There’s some good info on templates at the Pages page in the codex that could get you rolling.

    Thread Starter rforster

    (@rforster)

    I made this work, kinda. Made a template with:
    <?php
    /*
    Template Name: Template_php
    */
    ?>

    Then I cut and paste my database call. saved and uploaded the file into themes default. Loaded the page and it worked! Pretty ugly though.

    I added the code from the index so my template has:
    <?php
    /*
    Template Name: Template_php
    */
    define(‘WP_USE_THEMES’, true);
    require(‘./wp-blog-header.php’);
    ?>
    No change. Figure this would call the header and us the theme stuff.
    On the right track but not quite right…

    Thread Starter rforster

    (@rforster)

    Actually thought I had made a template. Going back to read more from the link you gave. thx
    Edit: I think I should have modified page.php and put my code inside <div id=”content” class=”narrowcolumn”>
    </div>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Connect to external database?’ is closed to new replies.