• 0be1

    (@0be1)


    Hello to all :o)

    I am a newbie on many levels (and I will just leave it at that for now) and was wondering if it might be possible to use WP for the following scenarios (even if plug / hacks and custom coding needs to be done as long as it is not too extensive). I work at a company who is revamping their current Intranet site that has pages that are custom coded in PHP and currently connect to an ODBC compliant database which will eventually be converted over to connect to an MSSQL database. We have no problem of running a *nix server and having the WP database stay in its native myssql formatted database. We are also planning on using WP more as CMS site than a blogging site.

    So here are some of the specs we are looking to do with WP.

    1) A framework (in this case WordPress) to work within to minimize custom code (which we currently have 40,000+ lines of code)

    2) Can handle 100% php calls from within pages listed on the site (currently have been trying to get the php-exec plugin to work without success)

    3) Being able to make calls within the php code to external databases that are not the wordpress database(ie , postgres or mssql).

    Here is a sample of the code we need to be able to run within a page in WP:

    $conn_remote=odbc_pconnect('gupta2','','');
    if (!$conn_remote){ odbc_close($conn_remote); die("Could not open Connection! Line 46");}
    
    				$material=array();
    				$test=array();
    				//$theMaterial= $engine[($row-1)];
    				$selMaterial= "SELECT WORK_ORDER.BASE_ID, WORK_ORDER.ACT_MATERIAL_COST AS Material FROM WORK_ORDER WHERE ".
    								"WORK_ORDER.BASE_ID LIKE 'E%' AND WORK_ORDER.ACT_LABOR_COST > 0 AND WORK_ORDER.PART_ID IS NOT NULL ".
    								"ORDER BY WORK_ORDER.BASE_ID DESC";
    				$execMaterial = odbc_exec($conn_remote,$selMaterial);
    while(odbc_fetch_row($execMaterial))
    				{
    				$material[]=odbc_result($execMaterial,"Material");
    				//$test[]=odbc_result($execMaterial,"WORK_ORDER.BASE_ID");
    
    				}

    These are a few of the main hangups we have ran into so far. We were originally going to use Joomla, but the current code was too complex to use and not enough plug-ins or hacks (especially running php natively within the pages) was available.

    Any help or advise that someone is well versed in the CMS world would be greatly appreciated. If this post is in the wrong group, I apologize, and if you need to move the post, I understand. I will not double post.

    Sincerely,

    Shawn

Viewing 8 replies - 1 through 8 (of 8 total)
  • The best way to run php is to make a template. I’ve found the php plugins will eventually fail.

    Best thing is to copy page.php, and name it something else.
    Add a page template header to it at the top

    <?php
    /*
    Template Name: Whatever
    */
    ?>

    And then you are free to add in your custom php. Most likely In place of, or near the_content

    Then you can create a page through WP the normal way, but assign it this new template which will have your php code

    Thread Starter 0be1

    (@0be1)

    @ Rev. Voodoo

    Thank you for your reply. I have been trying to work that one at as well, but the thing I am confused on is does the custom php code go in the custom.php page (or whatever I choose to name the page) or do I copy and paste the code I want to run in the WYSIWYG editor under the html tab (say for example my database connection code I posted in my original post).

    Right now all I am getting is my table (with no populated data from our other database) and no data, so I am obviously still doing something wrong or code is being stripped somewhere.

    Thanks again for your reply!!

    It goes into the page. Right into the coding.

    Entering php into the wysiwyg isn’t supported by default, and even with plugins which allow for php coding, I’ve found some code still fails.

    So when I need to use php in a page, I make a template, and apply the php directly into the template

    Thread Starter 0be1

    (@0be1)

    Hmmm… I wonder what I am doing wrong then when inserting the code directly into my page then. Do you have any suggestions for turning on any sort of error trapping? The code that I am trying to run through a custom WP page is currently working as a stand alone single php page on our current server so I know the code I am copying is working and good.

    TIA…

    Thread Starter 0be1

    (@0be1)

    I guess maybe here is a better way to ask the question when it comes to WP and custom php code. When using custom pages (as mentioned in the example above) are here any php limitations due to WP constrictions and custom code.

    Thanks again…

    jerrysarcastic

    (@jerrysarcastic)

    The visual editor does not support the addition of code, with the exception of WordPress shortcodes. If you switch over to the HTML view, you can add HTML code, but not PHP. For that, you will need to create a custom page template, as Rev. Voodoo suggests, and run your PHP there.

    In order to use the page template, create a new page, and specify the template you created. You can leave the text editor window blank; assuming everything the “page” needs is in the page template code, you don’t need to add anything in the editor.

    Thread Starter 0be1

    (@0be1)

    Problem solved once the proper odbc connector was installed and configured appropriately. Thanks for everyone’s help. This is going to open A LOT of possibilities for our new site. Both myself and the boss are excited!!!

    Thanks again…

    Shawn

    Coolio! Glad you got it sorted out!!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Newbie in more ways than one’ is closed to new replies.