Announcement

Collapse
No announcement yet.

Dynamic include file

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

    Dynamic include file

    I'm working on www.snazzles.net and it has a dynamic rotator jpeg banner file which I link to using...
    Code:
    <actinic:block php="true">
     $a = file_get_contents("http://www.snazzles.net/rotator.php");
     echo ($a);
    </actinic:block>
    In the rotator file, I have a MySQL/PHP recordset that gets the name of the images from our database and lists them at random, so that each time some one visits the homepage, they will see a different image, thus adding variety to the homepage.

    so the recordset has a script like this...
    Code:
    SELECT * FROM banners WHERE imagetype = 1 ORDER BY RAND()
    I have a 'repeat region' to then list the banners in my html.

    Each time I upload, Sellerdeck retrieves the include file and the images are sorted at random, then uploads it. The problem occurs when I access the website - the banner is static.

    I was hoping that the home page would retrieve the rotator.php file each time a web user visited the home page and then retrieves the images at random. But this only happens each time I upload (sellerdeck retrieves the banners PHP coding, rasterises it and embeds it as static HTML).

    Is there a way taht I can get it to just link to the rotator.php so that when I upload new banners via our CMS, then the home page will retrieve the new banners 'on the fly' without having to upload from Sellerdeck.

    Any help would be appreciated.

    Thanks in advance.
    ____________________
    Paul Daly
    www.dalydesign.co.uk
    web design | graphic design | illustration

    #2
    In your SD layout:
    Code:
    <img src="randomimage.php" />
    On your server create file randomimage.php that looks up a random image file-name, loads it as a GD image and then outputs it as an image via imagejpeg.

    Alternative way:

    In your SD layout:
    Code:
    <script type=text/javascript src="randomimagefile.php"></script>
    On your server create file randomimagefile.php that looks up a random image file-name and echoes it out via a line like:
    Code:
    echo 'document.write(\'<img src="' . $randominagefilename . '" />)\';';
    N.B. Not debugged.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Thanks Norm, I'll have a look at this later. ...I'm sure I tried teh second method and still had same issue (use JS in a remote file to point to another remote PHP file)

      The reason I gave the above example is that I have quite a few rotators of both text and imagery on other sites.

      i.e. customer reviews, client photo gallery.


      So where i might have product reviews, sorted by date on a particular product. On the homepage, I want to maybe list 5 customer reviews completely at random each time teh page is visited.

      I did write a php script loading the data into an array, and tehn displaying the array at Random. but Sellerdeck rasterises the PHP before upload (it doesn't preserve the PHP and let the web server rasterise the PHP). That's why I was hoping to have a file on the server that is requested each time a web user visits the website. (see the customer testimonial on http://www.nielsencdg.co.uk - it only changes when the customer uploads).
      ____________________
      Paul Daly
      www.dalydesign.co.uk
      web design | graphic design | illustration

      Comment


        #4
        But Sellerdeck rasterises the PHP before upload (it doesn't preserve the PHP and let the web server rasterise the PHP).
        Are you sure?

        I just put the following into a 12.0.2 layout and changed the page name to end in .php:
        Code:
        <?php
        echo (2 * 2) . 'woot';
        ?>
        And it works just fine (4woot is displayed).

        Are you sure that your pages are being parsed as PHP?

        If SD is uploading them as .html files the server probably won't pass them through PHP. You need them to be .php files.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          UPDATE

          I see that you have customer accounts. In this case logged-in customers pages will be served by Perl scripts and getting PHP parsed (as per immediately above post) will be difficult. However my post #2 methods will work.
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment

          Working...
          X