We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30448
    • 4 Posts
    Hello, I’ve only posted here a couple times before but I hoping you all could help me. I just recently graduated college and am helping with a start up a friend of mine is doing and I want to do this in the most useful and structured way possible. I’ve tried doing sites using a primitive template function in php, but it’s gainly and ackward. I’ve been looking at CMSs but my needs for this site are very particular. The templating is a must but what makes it so difficult is that virtually every page has unique PHP script built into the core of it to the point where only a handful of pages have content that isn’t dependent on information retrieved dynamically from a MySQL database (indeed a large part of it could be rightly called a web application). Most content management systems I’ve seen seem to be more focussed on letting a large number of people with no computer skills edit the site, where as my primary need is for a structured, uncomplicated programmer friendly environment that allows me to use templates to control the superficial stuff.

    I’ve been using MODx so far but there are a couple of things that keep it from being truly satisfactory. The main being that I have to essentially make all my pages snippets (because most of the pages depend on PHP code to function) and that is annoying and just complicates things. Another thing is that I would like to be able to have different folders be used (like website.com/employee_section/ and website.com/client_section/) for seperate sections of the site.

    Is there anything I can do about that with MODx? if not, do you know of any other CMS that would suit those needs. Most of the sites I’ve found depend so heavily on corporate buzzwords that I can’t ever figure out what they do.

    Thanks
    -mike
      • 25663 MODX Staff
      • 12,272 Posts
      Turn on friendly URL paths for the second desire (site sections with visible directory paths), and possibly add SEO Strict URls. Without knowing more about the functionality that requires all your pages to be snippets there’s no advice to offer there.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 34017
        • 898 Posts
        Mike,

        Does the layout of your pages look totally different or do they have layout in common?

        Is there a lot of large queries?

        Are there a lot of complicated queries?

        Could you post some example snippets/queries needed? That would help out.
          Chuck the Trukk
          ProWebscape.com :: Nashville-WebDesign.com
          - - - - - - - -
          What are TV's? Here's some info below.
          http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
          http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
          • 30448
          • 4 Posts
          Yeah, here’s a sample file:
          <?php
          
          if(!checkClient())
              redirect("index.php");
          
          
              if (!empty($_GET['interval']))
                  $weekInterval = $_GET['interval'];
              else
                  $weekInterval = 0;
          
          $myid = $_SESSION['myid'];
          
              $query = "SELECT DISTINCT store_brands.name, stores.store_number AS storeNum,
                                  shops.shop_date AS date, shops.shop_time AS time, shops.id
                        FROM little_bird.shops, little_bird.responses, little_bird.tests,
                             sea_stallion.store_brands, sea_stallion.stores, sea_stallion.times,
                             sea_stallion.accounts, sea_stallion.clients
                        WHERE
                        shop_date >= SUBDATE(
                                        SUBDATE(
                                          CURDATE(), INTERVAL ".(7 * $weekInterval)." DAY
                                        ),
                                     DAYOFWEEK(
                                        SUBDATE(
                                          CURDATE(), INTERVAL ".(7 * $weekInterval)." DAY)) - 1) AND
                        shop_date <= ADDDATE(
                                        SUBDATE(
                                          CURDATE(), INTERVAL ".(7 * $weekInterval)." DAY
                                        ),
                                     7 - DAYOFWEEK(
                                        SUBDATE(
                                          CURDATE(), INTERVAL ".(7 * $weekInterval)." DAY))) AND
                        shops.testid = tests.id AND
                        tests.time = times.id AND
                        times.storeid = stores.id AND
                        responses.shopid = shops.id AND
                        stores.accountid = accounts.id AND
                        clients.account = accounts.id AND
                        clients.id = $myid AND
                        stores.brandid = store_brands.id
                        ORDER BY shop_date, shop_time";
          
              $shops = resourceToArray(BlueBird::oneTimeQuery($query));
          
              $content = clientShopView($shops);
          
          echo $content;
          
          
          ?>
          
          </body>
          </html>
          ?>


          That’s the code I put in the snippet. The page itself is just [[snippetname]]. Most of the page is the same the only real different is in the content area, but the content area on nearly every page is unique and almost without exception generated on the spot using php. The code for viewClientShop is in another file altogether (which beg the question: does every one else put functions that are frequently used in snippets?) as is the code for checkClient. Though this isn’t the best example often the PHP is rather complex. But the code above creates all the content for the page (header, footer, etc, largely remains the same).

          I hope that’s enough information.

          -Mike