Forums

[resolved] Connect to external database? (4 posts)

  1. rforster
    Member
    Posted 4 years ago #

    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.

  2. Chris_K
    Member
    Posted 4 years ago #

    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.

  3. rforster
    Member
    Posted 4 years ago #

    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...

  4. rforster
    Member
    Posted 4 years ago #

    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>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.