Announcement

Collapse
No announcement yet.

How does PHP work in Actinic v8?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How does PHP work in Actinic v8?

    Hi there,

    Im experimenting with the V8 designer trial. I read that PHP can be used - how does this work and how do I use it.

    When putting PHP into the templates, does it get parsed on the server at page load, or do I have to have PHP installed on my system to run the code before upload? Or does actinic have a built in PHP process?

    I cant find any documentation on this and if I search the forum for PHP I get 0 results!!

    Help much apreciated.

    M.

    #2
    The forum search works on 4+ characters so I understand.

    For PHP see http://community.actinic.com/showthread.php?t=22153 amongst others where is was first discussed


    Bikster
    SellerDeck Designs and Responsive Themes

    Comment


      #3
      Actinic comes with a built-in PHP processor to enable PHP expressions within layouts. These scripts are only executed on the desktop and are not used to dynamically change things online.

      Also, see the AUG for details of how to use.

      HTH

      Chris
      Ladies Swimwear
      www.li-fi.co.uk

      Comment


        #4
        nice!

        Ok so it runs its own version of PHP and executes before upload.

        Can you connect to mysql databases with it? I was about to try but I put in phpinfo(); into my overall template and it crashed - cant get in anymore will have to find the template file and remove it before starting up actinic again...

        any way can I do this:

        $connection = mysql_connect ("localhost","db", "pw") or die ("Cannot make the connection");
        //connect to database
        $db = mysql_select_db ("db",$connection) or die ("Cannot connect to database");

        M.

        Comment


          #5
          You can try. I've posted a demo of interrogating the Actinic database from the built-in PHP. Here it is:
          Code:
          <actinic:block php="true">
          $connect = odbc_connect("ActinicCatalog8","","");
          # query the FileList table for files uploaded info
          $query = "SELECT sFileName, sExtension, Date, sMD5Hash, Path FROM FileList";
          # perform the query
          $result = odbc_exec($connect, $query);
          # fetch the data from the database
          $flist = array();
          while(odbc_fetch_row($result)){
            $name = odbc_result($result, 1);
            $ext = strtolower(odbc_result($result, 2));
            $date = odbc_result($result, 3);
            $md5 = odbc_result($result, 4);
            $path = urldecode(odbc_result($result, 5));
            $path = strtolower(preg_replace("/^\{SITE\}/", '', $path));
            // we're only intersted in JPG's
            if ( $ext == 'jpg' )
          	{
          	$flist[$path] = array($name, $ext, $date, $md5);
             	}
          }
          # close the connection
          odbc_close($connect);
          </actinic:block>
          
          <table>
          <actinic:block php="true">
          foreach($flist as $file)
            {
            echo "<tr><td>$file[0]</td><td>$file[1]</td><td>$file[2]</td><td>$file[3]</td></tr>";
            }
            </actinic:block>
          </table>
          NB - Just a hack - no error checking.
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment

          Working...
          X