Announcement

Collapse
No announcement yet.

PHP includes?

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

    PHP includes?

    Hi all,

    I have a site which features many primary templates and I would like to display some infoboxes on some of those templates. My idea is to create a blank column on the right hand side of my templates and create a php include file that I can modify whenever needed. The include file will start off as just a simple block of info like delivery terms, special offers etc. I would like to have that master file and then just define the include function in whatever templates I want.

    Can this be done? I presume all the Actinic pages will have to have the PHP extension but how can that be done easily?

    Kind regards

    Granthams

    #2
    I do something similar by including the external file within the templates.

    the benefits:

    - All pages remain HTML for faster serving & reduced server load
    - No messing about with menus, links, extensions, etc.

    The downside:

    - When you alter the included file actinic will upload all the pages that contain the file's content when you do an update.

    As long as you have decent internet access and no ftp problems then I'd go with my way.

    Mike
    -----------------------------------------

    First Tackle - Fly Fishing and Game Angling

    -----------------------------------------

    Comment


      #3
      Don't forget also that pages where you run CGI (search results, logged in, etc) won't parse PHP.

      I wanted to do the same with extra includes but have resorted to javascript as it works under all conditions.
      http://www.johnsons-seeds.com - Actinic plugins, remote add to cart and custom CMS
      http://www.dtbrownseeds.co.uk - More seeds and plants....
      http://www.mr-fothergills.co.uk - Well it used to be Actinic...

      Comment


        #4
        Thanks guys,

        So do you mean that all my pages can keep the .html extension? That would be great.

        How do you insert the includes into your pages olderscot?

        Regards

        Granthams

        Comment


          #5
          I do this with customvars.

          the menu I use on surf-wax is infact the actinic generated sitemap, copied into a txt file, and customvared.

          Also my related links are the same.

          it does mean i have to change the txt file if I change delete/add sections, but that isn't often

          the advantage is I get clean links for spiders rather than JS links

          Comment


            #6
            If you have a small amount of info that changes frequently, and that you want displayed on every page then this trick will allow you to do it without needing to upload every page whenever that info changes.

            In Act_Primary.html, where you want the info displayed put:

            Code:
            <script language="JavaScript" type="text/javascript" src="myinfo.js">
            and create a file in Site1 "myinfo.js" containing.

            Code:
            document.write('<b>Wowza!</b>');
            Edit myinfo.js whenever things change. You can have as many document.write lines as you need.
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              To include a file anywhere in your page just do:

              NETQUOTEVAR:INCLUDE filename.html

              where you want the content to appear. Nice and easy.

              Mike
              -----------------------------------------

              First Tackle - Fly Fishing and Game Angling

              -----------------------------------------

              Comment


                #8
                Sure. That's the standard technique.

                However, that INCLUDE operates at page generation time so if you use it on every page it will require all your pages to be uploaded whenever the included info changes.

                The JavaScript include doesn't require any extra uploads (other than the tiny bit of JavaScript) as the file is included when the page is dowloaded by the customer.
                Norman - www.drillpine.biz
                Edinburgh, U K / Bitez, Turkey

                Comment


                  #9
                  You're right Norman, but it only uploads the html files, not images or any of the actinic stuff so it won't normally take very long. It also has the advantage that google sees the new file modified time and will spider the pages again. Good for ranking and fresh tags.

                  Mike

                  PS. I forgot to mention that I can also generate HTML files using excel macros so generating the content can be automatic too.
                  -----------------------------------------

                  First Tackle - Fly Fishing and Game Angling

                  -----------------------------------------

                  Comment


                    #10
                    Another method I use is the inclusion of an inline frame in ActPrimary. This frame calls a php page which pulls random special offers out of a MySQL database.
                    Pros:
                    Simple
                    No need to change extension from .html to .php (or to configure server to parse all html files as php)
                    Cons:
                    Older browsers have poor/no support for iframes - not much of an issue nowadays!
                    Chris
                    -----
                    http://www.livingaidsonline.co.uk

                    Comment


                      #11
                      Another trick that I'm using at present is a way to get PHP generated data onto a normal Actinic generated HTML page without requiring PHP to parse the .html pages at all is to use PHP to generate and return an image.

                      E.g. Somewhere in your templates have

                      <img src="phpinfo.php">

                      and have a bit of PHP phpinfo.php that generates and outputs a GIF or JPG image.

                      You can make choices at image generation time via
                      Code:
                      <img src="phpinfo.php?param1=CUSTOMVAR:PARAM1&param2=CUSTOMVAR:PARAM2">
                      so that the PHP image can be genrated dynamically using the supplied parameters.

                      There's rather an extensive demo of this on http://www.drillpine.biz/v7fastframe..._Products.html where you can modify the picture frame by choosing different icons. We don't need to refresh the whole page; just replace the image with another.
                      Norman - www.drillpine.biz
                      Edinburgh, U K / Bitez, Turkey

                      Comment


                        #12
                        Thanks guys,

                        There are some great suggestions there. I think I will give them all a try and see which one suits the site best.

                        Many thanks

                        Regards

                        Granthams

                        Comment

                        Working...
                        X