3 Replies Latest reply: Mar 15, 2011 2:02 PM by Nancy O. RSS

    Editing PHP Includes in Design View

    Shan-Dysigns Community Member

      For this issue:

      I have a "main.php" file with a php include script to "page1.htm"

       

       

      I work in Split View (code on top/content on bottom). The menu above these view choices are links to any linked documents (to where you can click on any of the links to go to that page to edit).

       

      Looking in the Source Code panel, I can click on the php script above, and in the properties panel, I can click a button to open up and edit the page1.htm document. When this page opens (as it's really already opened because it's a linked file), I can only seem to edit this page in the Source Code. I can no longer click anything in Design View to select that particular area of code. Normally, when you click an area in Design View, your cursor will move to and highlight that code (of course you have to be viewing Source Code at the same time).

       

      Is this just the way includes work? It seems using includes takes out part of the wysiwyg funcitonality.

        • 1. Re: Editing PHP Includes in Design View
          Nancy O. CommunityMVP

          HTML pages do not typically parse data on the server (unless you have made special provisions for this with your host.).

           

          In most cases, for server-side includes to work, the parent page (page1.htm) would need to be named page1.shtml or page1.shtm or page1.php.

           

          Include files can be named anything you wish (include.foo).  But if you want to edit them in design view, use an .htm or .html extension (include.htm).

           

           

           

          Nancy O.
          Alt-Web Design & Publishing
          Web | Graphics | Print | Media  Specialists 
          http://alt-web.com/
          http://twitter.com/altweb

          • 2. Re: Editing PHP Includes in Design View
            Shan-Dysigns Community Member
            But if you want to edit them in design view, use an .htm or .html extension (include.htm).

            My included file is named "page1.htm" - this is not the main html document - when you mentioned the parent page as "page1.htm", that threw me off. The parent page is "main.php", correct?

             

            Here is what I'm trying to accomplish (which I'm sure is not the most orthodoxed way):

             

            I will have several shopping cart itmes on a page - each item will have quite a bit of code for drop down menu options (for customizing the product) - instead of having a ton of code on the main page, I was trying to find a way in which I could make a separate document for each item and only need one line of code (per item) in the main document in order to insert. Each page would basically be a form object with some encrypted PayPal code. Am I attemping something that won't work? My main goal is to be able to edit the included file in Design View. If you saying that's possible, can you please set up a simple test for me in which the main file would have an include to an external document with (let's say a textfield object)? I would like to be able to click that textfield object while in Design View and have that particular code be highlighted in "code view".

            • 3. Re: Editing PHP Includes in Design View
              Nancy O. CommunityMVP

              Includes are mainly used for snippets of re-usable code that appears throughout your site.  Some examples would be common headers, menus, ads & footers that may require changing from time to time.  By keeping them in include files, you can update an entire site by editing and re-publishing 1 or 2 files instead of every page in the site.

               

              For shopping cart sites, it is often better to store product data in a server-side database and insert PHP code to bring the data into cart pages. Dynamic sites typically have only a few static pages.  All the heavy lifting is performed by the server.  If you're new to shopping cart sites, look at Cartweaver or Web Assist.

               

              Cartweaver

              http://www.cartweaver.com/

               

              Web Assist eCommerce Options

              http://www.webassist.com/support/ecommerce-options.php

               

               

              Nancy O.
              Alt-Web Design & Publishing
              Web | Graphics | Print | Media  Specialists 
              http://alt-web.com/
              http://twitter.com/altweb