We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37047 ☆ A M B ☆
    • 309 Posts
    I'm trying to get up to speed with a MODX Evo site I inherited and updated to 1.0.5. Have made a local copy for testing on my Wamp server and the installation was all green lights; the manager looks fine and is working properly.

    However, the site preview gives me this:
    documentIdentifier == 359){ return; } if($modx->getLoginUserID() > 0){ $user = $modx->getWebUserInfo($modx->getLoginUserID()); } else { $user = array( "id" => '0' ); } $modx->toPlaceholders($user, "user."); include_once('cart.php'); $cart = new cart; $basket = $cart->load(); if(isset($_REQUEST['cart'])){ $quantity = (int)$_REQUEST['cart']; if($quantity > 0){ $cart->add_to_cart($modx->documentIdentifier, $quantity); $modx->sendRedirect($modx->makeURL(15)); } } if(isset($_POST['post']) && $_POST['post'] == "update_cart"){ //here //var_dump($_POST['product']); if( isset($_POST['product']) && is_array($_POST['product']) ){ $cart->emptyCart(); foreach($_POST['product'] as $product_id => $quantity){ //var_dump($quantity); $cart->add_to_cart($product_id, $quantity, "yes"); } $basket = $cart->load(); $modx->sendRedirect($modx->makeURL(15)); } } $modx->toPlaceholders($basket, "cart."); ?>
    Parse error: parse error in C:\wamp\www\KnitCollage\web\content\web_assets\snippets\mgr.php on line 15


    The mgr.php file:
    <?php
    
    $user = $modx->getLoginUserID('mgr');
    
    if($user > 0){
    	?>
    	
    	<style type="text/css">
    	 .shop_left .patterns {
    	 	display: block;
    	 }
    	</style>
    	
    	<?
    }
    


    I've never seen a snippet file that didn't end with a closing php tag, but adding one doesn't fix the error. Strangely, the remote site works and doesn't give the parse error so it doesn't seem to mind the strange snippet.

    Any suggestions for fixing this snippet, if it is if fact broken...?

    [ed. note: lucy last edited this post 14 years, 7 months ago.]
      Lucy Iannotti
      Following Sea design & development
      http://www.following-sea.com
      New Bedford, MA
      • 4310
      • 2,310 Posts
      On line 14 you have :
       <?

      Possibly your Wampserver doesn't allow PHP short tags.
      Try changing it to :
       <?php
        • 37047 ☆ A M B ☆
        • 309 Posts
        Aha! that was it thanks! I replaced the short tags in this one and 24 other snippets.

        Now my question is - should I update these files in the remote site as well - even though the remote site is working? Is it best practice to always use the full PHP tag?
          Lucy Iannotti
          Following Sea design & development
          http://www.following-sea.com
          New Bedford, MA
          • 4310
          • 2,310 Posts
          I do, often you have little/no control over shared hosting server settings and a PHP upgrade might set the default to not allow short tags.
            • 37047 ☆ A M B ☆
            • 309 Posts
            Setting up this local copy has been nothing but headaches because my WAMP server uses PHP 5.3.0 and the remote site server uses 5.2.13. Now that I've got the PHP tags sorted (thank you again!) I'm having troubles with phpThumb and the deprecated ereg issue.

            Is it Friday night yet?
              Lucy Iannotti
              Following Sea design & development
              http://www.following-sea.com
              New Bedford, MA
              • 4041
              • 788 Posts
              You can have multiple php versions running on wamp, http://www.wampserver.com/en/ then click downloads, then choose the php addons link.
                xforum
                http://frsbuilders.net (under construction) forum for evolution
                • 37047 ☆ A M B ☆
                • 309 Posts
                Multiple versions? Cool. Had no idea!

                Although, part of my reasoning for struggling through this is thinking that at some point the live site might be moved to a host running a newer PHP version, or like Bunk58 mentioned the current host might upgrade, and it would be good to get the kinks worked out locally first. I didn't build the site originally, so there have been many moments of discovery, most of them educational and interesting...
                  Lucy Iannotti
                  Following Sea design & development
                  http://www.following-sea.com
                  New Bedford, MA
                  • 18373 ☆ A M B ☆
                  • 3,141 Posts
                  I tend to have more kinks on local installs then on the server. #justsaying
                    Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                    Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                    • 37047 ☆ A M B ☆
                    • 309 Posts
                    Mark when you started off with "I tend to have more kinks on..." I thought this conversation was about to take a very different tack. #justsaying
                      Lucy Iannotti
                      Following Sea design & development
                      http://www.following-sea.com
                      New Bedford, MA
                      • 18373 ☆ A M B ☆
                      • 3,141 Posts
                      Lol laugh Sorry for that, wasn't my intention wink

                      Only wanted to make a point in that it's more important to have it running where it needs to be then a local environment which, from my experience anyway, often leads to more problems smiley
                        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.