Menu

PHP code within exponent

Designers
Anonymous
2005-06-07
2013-04-17
  • Anonymous

    Anonymous - 2005-06-07

    Hello Everybody,

    I am trying out various CMS for my company. My specific need would be to create pages with php code written by me.

    I know that Drupal can do this stuff, but i found exponent to extremely user friendly. Is there way we can create php files in exponent.

    Any help is greatly appreciaetd.

    Thanks.
    Giri.

     
    • James Hunt

      James Hunt - 2005-06-07

      Well, the page module (separate add-on) allows you to upload a PHP file and execute it, however there is no textmodule-like PHP module.  If there is sufficient interest, I could write one.  How does Drupal do it?

       
    • Anonymous

      Anonymous - 2005-06-07

      Can you be more detailed on page module. I didnot undertsand that part.

      I dont know exactly how drupal does it, i will surely look into it and give more details about it.

      Drupal provides the adding php-code between html with tags like this
      <?php
      php-code
      ?>
      which works fine.

      I found the mamboserver uses something like kl_php (mambot)  where php code is inserted as follows:
      {kl_php}
      php_code.
      {/kl_php}
      I didnot like this specifically because we dont need any new tag system here, but we need to use existing tags.

      Thanks for quick Reply.
      Giri.

       
      • James Hunt

        James Hunt - 2005-06-07

        The Page Module is an add-on for Exponent.  You can download it here on Sourceforge.  By 'add-on' I mean that it is not included in the core distribution.

        The page module is used to display a single on-server page.  For instance, you may have an HTML file that is updated outside of Exponent (for instance, generated by another software program) that you want to appear inline on one of your pages.  Instead of copying that HTML and pasting it into a text module, you can add a page module and upload that file to it.  The next time it changes, upload it over the top of the old one.

        An additional twist on the page module (and what makes it most useful IMHO) is that you can upload a PHP file and choose to either highlight the source code (I use it on my personal intranet for code examples) or execute the PHP code.  The last option (execution) allows people to write small scripts in PHP that can be run, and saves them the hassle of writing a full-blown module when it is not needed.

         
        • Tom Zeiler

          Tom Zeiler - 2005-06-08

          James said:
          An additional twist on the page module (and what makes it most useful IMHO) is that you can upload a PHP file and choose to either highlight the source code (I use it on my personal intranet for code examples) or execute the PHP code. The last option (execution) allows people to write small scripts in PHP that can be run, and saves them the hassle of writing a full-blown module when it is not needed.

          Tom says:
          The big drawback I find to using the page displayer for running code is that you can't edit 'in place' like you can with the contents of a text module.  Say I want to do a bit of meddling, but for one reason or another I don't happen to have access to the file that I uploaded into the module.  I can still always get at the code (by setting the configuration to 'display' rather than 'execute'), but then I have to do a copy-paste-edit-save-upload dance (and then set the module configuration back to execute).

          I use the example of not having access to the file that was originally uploaded, but the situation is not really too much different even if I do have access to it. I still have to switch to an external editor and save to a file, then go through the upload process for the module.  It's all perfectly functional, but not very convenient.

          I for one would very much like a dedicated module for working with scripts that is as easy to use as the text module is (and so, as soon as I get the time to figure out how to write modules ...).

          -t

           
          • David Andor

            David Andor - 2005-06-11

            I am also finding that I want to embed PHP scripts into Exponent architecture, not just little single-page ones - for example, one client wants shoutboxes at the bottom of certain pages, and we don't use logins for any visitors so really don't want to invoke the bulletin board module. Currently, though I have yet to implement this, I believe I can do it by creating a specific theme for a page which includes an include statment on the theme template.

            But what would be cool would be to be able to direct Exponent to a subdirectory where a script is sitting, and then get it to run that script within a container on a specified page. This would allow all sorts of expanded functionality to run inside the Exponent framework, and would be a huge boon, I feel. However, this may also raise security issues or even may be rather difficult to implement.

            In the meantime, I'm going to work with subthemes and see if this gives me any joy.

             
    • David Andor

      David Andor - 2005-06-11

      By the way, if the page module can run a single page of code, then perhaps if I upload the index.php page from a more extended script, hunt down where Exponent has tucked it away, and then upload the rest of the script into the same subdirectory . . .???? I have yet to look at this properly, but thanks for the tips.

       
      • Anonymous

        Anonymous - 2005-06-11

        ****James Correct Me If I am Wrong****

        To David Andor:
        Well i dont think we can do that, beacuse the page module stores your code in database, and not as a file. so basically, you never have it on your files list.

        If we could do that, like upload to file(well it has other issues to resolve, like security), the links are produced by the databse, but not seeing your file structure.

        So what we would need is a module to connect to the file structure, and giving all the provisions, the exponent provides.

        That will make some things better, as for companies like mine would want a slow transform to new system, and thus we can have all the present working code in Exponent and it is manageable.

        Well first i have to figure out how to write a module. ;)

        If someone could share there viewpoints, we can finalize the module.

         
        • David Andor

          David Andor - 2005-06-12

          Yep, I am seeing this myself too - of course all pages are stored in the database (doh!) which sort of nukes their extended functionality.

          I am going to have to go to IFRAMEs to get my shoutboxes going, which is OK, it's just that I know people with older browsers are going to have issues with these . . .

           
    • Edward

      Edward - 2005-06-21

      Quote: ..... If there is sufficient interest, I could write one. How does Drupal do it?...

      1. Yes there is is sufficient interest in this feature. As it simply vital to be able to integrate own PHP code into CMS
      And will be needed in %80 of all distributions.
      2. How Drupal does it.
      Well not sure...... but I think its a simple Eval statement ( could be wrong ). But the tricky part it will let you "emulate"
      file name........ such as you could name your page in any name. ( so you could use some already made script in your CMS by simply coping and paste )
      Also would be usefull ( for some people ) to have framed version.... where it will simply grab external page and display it in the frame.

      Not sure if I was %100 clear....... Thanks

       
    • Ballsacian1

      Ballsacian1 - 2006-06-24

      I was thinking about it and why can't we have a special tag in the text modules that declares a php statement.

      Once declared when the module is parsing the data it will check user permissions to ensure that only admins have the ability to create php tags in text modules.

       

Log in to post a comment.