WordPress.org

Ready to get started?Download WordPress

Forums

PHP code inside posts? (23 posts)

  1. rvoogdgeert
    Member
    Posted 8 years ago #

    Dear wordpress users,

    Does any of you have any experience with using PHP code inside posts? I tried two plug ins that completely messed up a post with some code (In WordPress 2.01) which syntax was absolutely correct.

    Any suggestion?

  2. MichaelH
    Member
    Posted 8 years ago #

    Which plugins didn't work?

  3. moshu
    Member
    Posted 8 years ago #

    If WP 2.x - never use the RTE if you are putting code in your posts!

  4. Tijmen
    Member
    Posted 8 years ago #

    RTE?

  5. vkaryl
    Member
    Posted 8 years ago #

    The "helper" facility.... rich text editor. Bad juju....

  6. Tijmen
    Member
    Posted 8 years ago #

    Ouch.

    I'm stupid today.

  7. vkaryl
    Member
    Posted 8 years ago #

    Nope. Some of us (moi aussi!) fail to think before using wholesale shorthand. Acronymism is alive and well at the support forum, even though we have no glossary.

    Sorry!

  8. moshu
    Member
    Posted 8 years ago #

    Full name: TinyMC wysiwyg* Rich Text Editor ;)

    ____________
    *what you see is what you get

  9. Tijmen
    Member
    Posted 8 years ago #

    So you think it's better to use French than use acronyms? :)

  10. vkaryl
    Member
    Posted 8 years ago #

    Nah, that's just me being a dingaling sometimes.... I can still read French fairly well if I concentrate, but I never could speak it worth beans, even though my accent was always good (more than good, actually - my accent got me a decent grade on the final one year in college....) "moi aussi" is about all I really can come up with any more!

  11. Tijmen
    Member
    Posted 8 years ago #

    Ah, moi aussi, je n'ecrire pas anything en Francais in a lot of années...

  12. vkaryl
    Member
    Posted 8 years ago #

    Probably not as many years as I.... graduated in 1971.... (AFTER a couple of years "off" to be married/have a daughter)....

  13. WPChina
    Member
    Posted 8 years ago #

    I have tried the runPHP plugin, but it doesn't work at all for me. I too need a way to pass PHP variables via either a Page or a Post. If anybody has ideas, please let me knwo too.

    Mon Français est pauvre, satisfait ainsi répond en anglais. Merci mes amis. (translation: my french is crap, so pls use English)

  14. vkaryl
    Member
    Posted 8 years ago #

    *laughing* Hey, better than mine is!

    I think I recall hearing that the php executable sort of plugins aren't working all that well so far with 2.0 - and I can't post a link right now, just tried my own "search recipe" only to get a 404 not found *sigh*.

  15. Tijmen
    Member
    Posted 8 years ago #

    I use RunPHP too, works great for me. What doesn't work about it?

  16. vkaryl
    Member
    Posted 8 years ago #

    I don't know because I don't use it. I just have in the back of my mind some posts about problems with it or the other one - phpexec?

    Was trying to search but can't get it to load.

  17. WPChina
    Member
    Posted 8 years ago #

    Sorry, I should have said "My French is crêpe".

    Yes, I tried all sorts of things like changing permalinks to add a ".php" to all links to make it possible to pass variables.

    For example, I want to do this:

    1) Pass a variable for "name" on a URL in my blog like http://localhost/blog/posts/my-post.php?name=Jean-Francois

    2) Embedded in my Post or Page is a short bit of PHP code that grabs that variable "?name=Jean-Francois" and displays the name.

    Simple. It works of course in flat PHP/HTML, but using WP causes problems. I am stumped.

  18. Tijmen
    Member
    Posted 8 years ago #

    Hmm. That works for me. I use blabla.com/?page_id=1&thing=2&id=34322, and this in the code:

    $thing = $_GET["thing"];
    $id = $_GET["id"];

    I only use it on static pages, but that shouldn't make a difference I think.

  19. MichaelH
    Member
    Posted 8 years ago #

    Or this plugin?

    CG-QuickPHP
    http://www.chait.net/index.php?p=310

  20. davidchait
    Member
    Posted 8 years ago #

    Thanks Michael, was just about to post a link myself! ;)

    QuickPHP is really targeted for single function calls or include statements (it does one 'method', with a parenthesized parameter list), constant arguments. But including a php script is then really easy, or calling a function (like any basic WP func..).

    I use it for embedding things like CG-FeedRead feeds, or wacky CG-Amazon stuff (since CG-Inline already has an amazon tag).

    -d

  21. WPChina
    Member
    Posted 8 years ago #

    Ahhh, relief. Got it to work. My stupid stupid problem was that I failed to tick the little "run PHP code?" box on the Write Post and Write Page area. Stupid me. Ok, now it's done and it works. Ah!

    Stupid me...

  22. vkaryl
    Member
    Posted 8 years ago #

    Well, hey.... at least you got it working now. And thanks VERY much for posting back, so the next poor soul can (maybe - since goddess only knows how long search will be broke herein) find the help heesh needs....

  23. WPChina
    Member
    Posted 8 years ago #

    No problem... but it took me a DAY to figure out that I forgot to tick that darn box. I am still shaking my head. I didn't sleep well last night because of it. Stupid stupid mistake.

    Yes, runPHP works very well for passing variables. I have not tried any of the other PHP addons, but assume they work well too.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags