10 Replies Latest reply on Jun 3, 2013 8:36 AM by MurraySummers

    Using PHP with Flex template/page

    jaykappy

      I currently have a basic site using PHP.  I want to migrate to use dreamweaver as my editor and as such am using the trial version.  I see the Flex template (page) that allows the developer to build the site with a PC, tablet and phone layout in mind.  BUT this is built as an HTML page by default.

       

      How to I join the PHP page (which I need for the php code I already have) and the edfault html page that the flex template gives.

      Can I simply change the extension to php once I have it set up?

        • 1. Re: Using PHP with Flex template/page
          MurraySummers Level 8

          What 'Flex' template? Can you give us a link to it?

           

          Also, can you show us the code on one of your PHP pages? What did you use to create it?

           

          PHP integrates with HTML nicely. In fact, you can just change your extensions to *.php instead of *.htm(l), and all pages will continue to render just fine, even though they may contain NO php code. So, the short answer to your question is "yes" you can just change the extension. Of course you'll need to do this in DW so that all of your page links are managed, and you'll need to worry about existing search engine links to your original page names, but that's for another question....

          • 2. Re: Using PHP with Flex template/page
            jaykappy Level 1

            I mispoke....I meant "Fluid Grid Layout"  I called them Flex Box Models..... I was simply using NotePad++ and IIS for testing.

             

            My problem was that I was usign PHP code....it would not run the php code untill I changed teh extension to php...

             

            THis is a sample from one page....note in the php page I am requiring  'require("commonMapLibrary.php"); "  THis is passing credentials to the MySQL server to allow for access to the tables

             

            As for search engine links....I am starting from scratch...all new in DW....

             

            The questions are ...

            1. HOW do I change the extension in DW so the Fluid Grid Layout is not effects as well as anything else?
            2. Have you used the Fluid Grid Layout before?

             

             

            Example of php page....

             

            <!DOCTYPE html>

            <html lang="en">

             

             

                      <head>

                    <meta charset="utf-8">

                    <title>Hello World</title>

                                <link rel="stylesheet" href="./css/main.css">

                                <script src="MainPageIndex.js"></script>

                                <!-- <link rel="stylesheet" type="text/css" href="css/main.css"> -->

                                <style>

                                          a:link {color:#6A8EA8; text-decoration: none}    /* unvisited link */

                                          a:visited {color:#006699;} /* visited link */

                                          a:hover {color:#FF6633;}   /* mouse over link */

                                          a:active {color:#000066;}  /* selected link */

                                </style>

             

             

                                <script src="jquery_min.js"></script>

             

                                <script type="text/javascript">

             

             

                                window.onload = function()

                                {

                                          $('#showListRadio').click(function(){

                                                    $('.listRow1').show(3000);

                                                    $('.listRow2').show(3000);

                                                    $('.iconRow').hide();

                                          });

                                          $('#showIconRadio').click(function(){

                                                    $('.iconRow').show(3000);

                                                    $('.listRow1').hide();

                                                    $('.listRow2').hide();

                                          });

                                }

                                </script>

             

             

                </head>

             

                <body>

             

             

             

                      <div id="big_wrapper">

             

             

                                          <h1 id="headerNoRed">

                                                    <span id="FirstSpan">city of Maple Grove</span>

                                                    <span id="SpanDepartment"> <?php echo $_GET["Dept"]; ?></span>

                                                    <ul>

                                                     <li><a href="memberlist.php">Memberlist</a></li>

                                                     <li><a href="edit_account.php">Edit Account</a></li>

                                                     <li><a href="logout.php">Logout</a></li>

                                                    </ul>

                                          </h1>

             

                                <div id="newdiv">

             

             

                                          <aside id="asidenewsleft">

             

             

                                                    <div align="center" ><br>

                                                              <input type="radio" name="group1" id="showListRadio" value="ListNew"> ListNew

                                                              <input type="radio" name="group1" id="showIconRadio" value="IconNew"> IconNew<br>

                                                    </div>

             

             

                                                    <button id="TableButton">Table View</button>

                                                    <button id="IconButton">Icon View</button>

                                                    <button id="ChangeViewButton">Change View</button>

             

             

                                                    <ul>

                                                              <li id="admin"><a href="/MainPageindex.php?Dept=administration" style="font-size:10pt;font-weight:normal;color:#6A8EA8;font-family:'tahoma';font-style:no rmal;">

                                                                                  <img src="../images/Logos/button.gif" align="center" border="0">        administration</a></li>

                                                    </ul>

                                           </aside>

             

                                          <section id="mainsection" >

                                                    <article id="articletop">

             

                                                              <?php

                                                                        require("commonMapLibrary.php");

             

                                                                        if(empty($_SESSION['user']))

                                                                        {

                                                                                  header("Location: login.php");

                                                                                  die("Redirecting to login.php");

                                                                        }

             

                                                                        $Dept=$_GET["Dept"];

             

                                                                        $query = "

                                                                                  SELECT

                                                                                            Yr,

                                                                                            MaplibraryName,

                                                                                            MaplibraryPath,

                                                                                            Description,

                                                                                            Path_jpg

                                                                                  FROM tbl_maplibrary

                                                                                  WHERE

                                                                                            Department = '$Dept'

                                                                                  ORDER BY

                                                                                            Yr DESC

                                                                        ";

             

             

                                                                        $stmt = $db->prepare($query);

                                                                        $stmt->execute();

             

                                                                        $rows = $stmt->fetchAll();

                                                              ?>

             

                                                              <table> 

             

             

                                                                        <tr class="listRow1">

                                                                                  <th>Image</th>

                                                                                  <th>Year</th>

                                                                                  <th>MapLibrary Name</th>

                                                                                  <th>Description</th>

                                                                        </tr>

             

                                                                        <?php foreach($rows as $row): ?>

             

                                                                        <tr class="listRow2" >

                                                                                  <td width="25"><a href="<?php echo htmlentities($row['MaplibraryPath'], ENT_QUOTES, 'UTF-8'); ?>" target="_blank"><img src="../images/Logos/leaf1.gif" alt=" "     border="1" height="20" width="20"></a></td>

                                                                                  <td width="25"><?php echo htmlentities($row['Yr'], ENT_QUOTES, 'UTF-8'); ?></td>

                                                                                  <td width="360"><?php echo htmlentities($row['MaplibraryName'], ENT_QUOTES, 'UTF-8'); ?></td>

                                                                                  <td width="395"><?php echo htmlentities($row['Description'], ENT_QUOTES, 'UTF-8'); ?></td>

                                                                        </tr>

             

             

                                                                        <div class="iconRow" id="borderdiv" style="display:none">

                                                                                  <div><a href="<?php echo htmlentities($row['MaplibraryPath'], ENT_QUOTES, 'UTF-8'); ?>" target="_blank"><img src="<?php echo htmlentities($row['Path_jpg'], ENT_QUOTES, 'UTF-8'); ?>" alt=" " border="1" height="100" width="100"></a></div>

                                                                                  <div id="tabtext"><?php echo htmlentities($row['Yr'], ENT_QUOTES, 'UTF-8'); ?></div>

                                                                                  <div id="tabtext"><?php echo htmlentities($row['Description'], ENT_QUOTES, 'UTF-8'); ?></div>

                                                                        </div>

             

             

                                                                        <?php endforeach; ?>

                                                               </table>

                                                    </article>

                                          </section>

                                 </div>

             

             

                                <footer id="bottomfooter">

                                          <p>Published: <time datetime="2011-07-22T13:59:47-04:00" pubdate>July 22, 2011 1:59 pm EDT</time></p>

                                 </footer>

             

             

                      </div>

                </body>

            </html>

            • 3. Re: Using PHP with Flex template/page
              MurraySummers Level 8

              I mispoke....I meant "Fluid Grid Layout"  I called them Flex Box Models..... I was simply using NotePad++ and IIS for testing.

               

              My problem was that I was usign PHP code....it would not run the php code untill I changed teh extension to php...

               

              Certainly true - unless the server is set to parse all files, you must have a php extension to trigger the parse.

               

              As for search engine links....I am starting from scratch...all new in DW....

               

              Good enough.

               

              The questions are ...

              1. HOW do I change the extension in DW so the Fluid Grid Layout is not effects as well as anything else?
              2. Have you used the Fluid Grid Layout before?

               

              1. Just edit the files in DW's Files panel to change the extension. It's as simple as that.

              2. I have but only for testing purposes. They are much too complex for me.

              1 person found this helpful
              • 4. Re: Using PHP with Flex template/page
                jaykappy Level 1

                THanks for your thoughts...very appreciated...

                 

                Question....if you are not using some sort of fluid layout or Flex box....how are you building to properly display in Tablets and phones?

                 

                Thanks again....going to give it a go....

                • 5. Re: Using PHP with Flex template/page
                  jaykappy Level 1

                  Certainly true - unless the server is set to parse all files, you must have a php extension to trigger the parse.

                   

                  Is there a way to use the Fluid Layotu in DW with the HTML extension and run PHP code???

                  • 6. Re: Using PHP with Flex template/page
                    MurraySummers Level 8

                    Is there a way to use the Fluid Layotu in DW with the HTML extension and run PHP code???

                     

                    Why would you want to do this?

                     

                    I build to display on tablets and phones using either responsive Wordpress themes (obviously building Wordpress sites), or I do it manually (with mobile queries).

                    • 7. Re: Using PHP with Flex template/page
                      jaykappy Level 1

                      Dont know....your comment said "unless the server is set to parse all files, you must have php extension"

                      Thoght you were insinuating that there might be a way to keep the html extension...I have no problems in isign a php extension.

                       

                      Will look into Wordpress Sites.....

                      Can you explain briefly doing this manulaly with Mobile Queries?  Are you getting the display size and then changing the layout?

                       

                      THanks Again....very apprecited.

                      • 8. Re: Using PHP with Flex template/page
                        MurraySummers Level 8

                        Dont know....your comment said "unless the server is set to parse all files, you must have php extension"

                        Thoght you were insinuating that there might be a way to keep the html extension...I have no problems in isign a php extension.

                         

                        There is a way to keep the html extension *and* run PHP code on the page, but it requires that you set the server on which the site is hosted to parse ALL files for scripting, not just those that are named with a 'script-type' extension (e.g., php, asp, cfm, etc.). Many hosts are reluctant to do this because of the additional load it places on the server. And when I go back to a site after some years where I have done this, it causes me a bit of early confusion!

                         

                        Wordpress sites are a learning experience. I don't recommend them for the faint hearted.

                         

                        With mobile queries, I just figure out where the 'break points' are for viewport widths that I want to support, and use DW's mobile queries to load an external stylesheet that rearranges the layout accordingly, one each for each screen size. So, a smartphone would load one CSS file, while a tablet would load a different CSS file. The CSS in those files causes the layout to rearrange to adapt to the specified viewport widths.

                        1 person found this helpful
                        • 9. Re: Using PHP with Flex template/page
                          jaykappy Level 1

                          Thanks again for your thoughts and patience....

                          I will look into the Mobile queries to accomplish this....but viewing the Fluid Grid Layout it creates the different CSS sections for each layout you specify automatically....so might stick with that.

                           

                          Just wonder why DW does not give you the option to choose PHP extension when you create the FLuid Layout Page.  would make life easier.

                           

                          THanks again....

                          • 10. Re: Using PHP with Flex template/page
                            MurraySummers Level 8

                            When you save the page, just save it with a php extension. I'm not sure I see the problem....