#1
  1. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2003
    Location
    Thessaloniki
    Posts
    1,280
    Rep Power
    13

    Question Embed python code inside a Joomla website?


    Hello everyone,

    My website is http://varsa.gr and is made in Joomla v1.5
    I will redesign it in Joomla v3 but i want to also ask this.

    I have programmed my own counters python program that is able to store and retrieve a seprate counter for every webpage i have.

    So my question is, if there is a way to use my python code inside joomla somehow so to make use of my counters.py script.

    Thank you.
    What is now proved was once only imagined!
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    It is possible, but extremely inefficient. You can do it by making a shell call in PHP, executing your Python script, capturing the output, and then returning the output to the browser.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  4. #3
  5. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2003
    Location
    Thessaloniki
    Posts
    1,280
    Rep Power
    13
    Why you say it is ineficcient? All it has to do is presnt bottown down a counter number.

    Can you give an example please?
    What is now proved was once only imagined!
  6. #4
  7. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    It's inefficient because it requires the server to create a new process, initialize the Python interpreter, and copy the input and output between the two processes. It would still be inefficient even if your Python script literally did nothing except exit on the first line.

    We actually had this discussion a couple months ago and there's an example there:
    http://forums.devshed.com/php-develo...la-941835.html
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  8. #5
  9. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2003
    Location
    Thessaloniki
    Posts
    1,280
    Rep Power
    13
    Its ok the server has enough ram and speed to hdanle this.

    i just dont know how to capture the output of the python script and return it to the browser.

    can you give me an example please?

    I want to try it becaus emy counters.py script can maintain counter statistics for every webpage of the webiste.

    Please provide me with a detailes example.
    What is now proved was once only imagined!

IMN logo majestic logo threadwatch logo seochat tools logo