+ Reply to Thread
Results 1 to 8 of 8

Thread: Editor is Stripping PHP Tags

  1. #1
    Join Date
    Jan 2012
    Posts
    89

    Default Editor is Stripping PHP Tags

    All,

    I have some PHP code that I'd like to include in pages on my wiki but every time I do so the leading <?php tag gets transformed to <!-- ?php. I have enabled the admin with the unsafecontent option and also set this in advanced config. How can I fix this and post PHP content to my pages?

    Thanks!

  2. #2
    Join Date
    Jul 2006
    Location
    San Diego, CA
    Posts
    5,450

    Default

    You can't put PHP into pages. Use DekiScript instead, which is the native scripting language for the system.
    Steve G. Bjorg - Chief Architect
    Did you check the MindTouch FAQ?
    Found a bug? Report it.
    Follow me on Twitter
    Find us on IRC: irc.freenode.net #mindtouch

  3. #3
    Join Date
    Jan 2012
    Posts
    89

    Default

    Thanks Steve. How exactly am I supposed to use DekiScript to accomplish this though? I have a related post at http://forums.developer.mindtouch.co...to-a-Wiki-Page with no solutions. Essentially there are some dynamic PHP pages that I have working fine standalone on the same server but I'm not sure how to translate this to DekiScript, extensions or whatever else is required based on the posts and documents I've come across. I have some development expertise so just some general guidance around this topic would help me on my way (and let me share the knowledge with others).

  4. #4
    Join Date
    Jul 2006
    Location
    San Diego, CA
    Posts
    5,450

    Default

    The easiest way to embed it without needing to learn DekiScript would be to create your custom pages in the /deki/mycustompages folder. Then use web.html() to include the output (e.g. web.html(site.uri & "deki/mycustompages/report.php")).

    It's not the nicest solution, but it will get you to many places. Note that web.html() removes unsafe content, such as embed codes and javascript. So stay clear of those.

    Good luck!
    Steve G. Bjorg - Chief Architect
    Did you check the MindTouch FAQ?
    Found a bug? Report it.
    Follow me on Twitter
    Find us on IRC: irc.freenode.net #mindtouch

  5. #5
    Join Date
    Jan 2012
    Posts
    89

    Default

    Thanks Steve. I created the "mycustompages" folder, placed the PHP file in it and included the file with web.html() after looking up its syntax. This seems to do the trick although updates made to the PHP page appear to take some time before they show live on the site (not sure if this is a MindTouch thing or a web server thing). Anyways, if you or another MindTouch expert have the time it would be great to learn how to use an extension or the proper way for the "nicest solution" to this problem. I am also looking to create a kind of button/extension for the editor that can transform our video IDs to another HTML embed tag.

  6. #6
    Join Date
    Jul 2006
    Location
    San Diego, CA
    Posts
    5,450

    Default

    web.html() caches the output for 5 mins by default. You can pass a different TTL value to drop that down to 60s, which is the minimum.

    If all you do is sql queries, you could also use the mysql extension and mark it as privileged in the control panel so that only users with UNSAFECONTENT permission (such as admins) can invoke it.
    Steve G. Bjorg - Chief Architect
    Did you check the MindTouch FAQ?
    Found a bug? Report it.
    Follow me on Twitter
    Find us on IRC: irc.freenode.net #mindtouch

  7. #7
    Join Date
    Jan 2012
    Posts
    89

    Default

    I tried to do {{web.html(site.uri & "deki/mycustompages/report.php",,,60)}} but I received an error message. I'm referring to http://developer.mindtouch.com/en/re...ables/Web.Html and only want to pass in the additional TTL parameter I guess.

    I'm doing SQL queries but also looking to format the results.

  8. #8
    Join Date
    Jul 2006
    Location
    San Diego, CA
    Posts
    5,450

    Default

    You need to pass in nil for parameters you're omitting. _ (underscore) is a shorthand for nil.

    Try this: {{ web.html(site.uri & "deki/mycustompages/report.php", _, _, 60) }}
    Steve G. Bjorg - Chief Architect
    Did you check the MindTouch FAQ?
    Found a bug? Report it.
    Follow me on Twitter
    Find us on IRC: irc.freenode.net #mindtouch

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts