Forums

Howto insert scripts into pages? (10 posts)

  1. tazatek
    Member
    Posted 4 years ago #

    Is there a language-neutral way to insert the results of server side scripts?

    ie. I have some C++ (and shell,lua, php, etc) scripts that return lists of data from a DB that I'd like to integrate into my WordPress blog.

    What is the easiest way to do this?

    I've seen mention of inserting a <script> tag (which didn't work) and I've also seen the use of a .shtml <include> tag (which won't help me here, that I'm aware of).

    Thanks

    Matt

  2. Otto
    Tech Ninja
    Posted 4 years ago #

    Is there a language-neutral way to insert the results of server side scripts?

    No.

    I have some C++ (and shell,lua, php, etc) scripts that return lists of data from a DB that I'd like to integrate into my WordPress blog. What is the easiest way to do this?

    Depends on lots of factors. How would you execute these scripts normally? I can think of various ways to do it, but which way you do it depends on what exactly you're doing. ;)

  3. haochi
    Member
    Posted 4 years ago #

    The Exec-PHP plugin can run PHP.
    http://wordpress.org/extend/plugins/exec-php/

    Or do you mean syntax highlighting?

  4. Otto
    Tech Ninja
    Posted 4 years ago #

    haochi: He doesn't mean either of those, he's talking about something similar to server-side-includes, basically.

    http://www.google.com/search?q=SSI+include

  5. tazatek
    Member
    Posted 4 years ago #

    The normal way that I call them is at a command-line and it outputs either to stdout, or a file. There are typically no arguments given, though occasionally there are.

    I'm wanting to have it auto-populate (ie no user-interaction) as a simple list of output, probably formatted within a <div> or <table>

    Thanks
    Matt

  6. Otto
    Tech Ninja
    Posted 4 years ago #

    The normal way that I call them is at a command-line

    That makes it tricky then, although not much. There's several PHP functions to execute local commands:
    http://php.net/manual/en/ref.exec.php

  7. tazatek
    Member
    Posted 4 years ago #

    Is there any way that I can turn on SSI inside of WordPress Pages/Posts? Looking around Apache's site, it looks like I might be able to include the output of a CGI inside of a <table>

    My biggest hangup is I don't know what to use for the AddType entry in my .htaccess/httpd.conf file. Any suggestions? All the examples use .shtml, but with WP being processed .php, I'm not sure of what to enter there.

    Thanks

    Matt

  8. tazatek
    Member
    Posted 4 years ago #

    I've tested the exec-php plugin to insert php code, and it works... but only for the last echo statement in my script.... any thoughts on this?

    Would anyone know if it would be the plugin, or a config/script issue?

    Thanks

    Matt

  9. tazatek
    Member
    Posted 4 years ago #

    Arrrgggghh.... seems 2 minutes after my post I figured it out... I was using an echo in the script, and it seems that it prefers printf.... different line endings by default IIRC

    But I'd still like to know if it is possible to activate SSI within WordPress.... for prosperity's sake I suppose :)

    Thanks

    Matt

  10. Otto
    Tech Ninja
    Posted 4 years ago #

    Not as such, but look closely at the PHP "virtual" function. It will make a callback to Apache to do the equivalent of a server side include.

Topic Closed

This topic has been closed to new replies.

About this Topic