We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11927
    • 105 Posts
    I’m trying to create a plugin for Modx Evo 1.0.4. My third that I’ve made so far, so still really new at it.

    What I want to do is be able to duplicate documents and if the duplicated documents have a certain TV, prompt the user for what the new TV will be, instead of having to go into the parent document and its children to modify the TV.


    My Ideas:
    I thought maybe after duplicating the doc having a ’pop-up’ window with an input box, much like the below code pops-up. But not as an error. Also, I’m not sure how to handle and get the data after the message pops-up.

    <?php $modx->event->alert("Help!"); ?>


    Then I thought about have an input box next to the ’Duplicate Resource’ option, but have no idea how to do that.

    Would managermanager help with this?

    Searched:
    Plugin Prompting User for Information
    Plug-in Prompting User for Information
    Plugin User Input
    Plug-in User Input
      You may or may not want to use the code I write. It&#39;s probably all against the syntax rules of php and MODx. smiley

      Carpet Cleaning
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      How are you duplicating the resource? In the Manager, or via QuickManager or some other front-end method?
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 11927
        • 105 Posts
        Sorry. I didn’t even think about explaining that.

        I am duplicating resources in the manager.
          You may or may not want to use the code I write. It&#39;s probably all against the syntax rules of php and MODx. smiley

          Carpet Cleaning
          • 11927
          • 105 Posts
          I think I mis-spoke, again.

          For my first idea I do know how to use the data, once I get it. I just don’t know how to prompt the user and then get the information from the user.

          Does mm_requireFields in ManagerManager prompt the user for the value that is supposed to go into the required field or does it just say you left it blank? - just tells user it was left blank, but won’t let you save it until there is something in the field

          Does mm_requireFields work with TVs? - yes


          Idea #3:
          I think I could make the TV required for the Template it is assigned to.
          Then when I duplicate a document that has that TV, make it empty using a plugin.
          Then on save that document perpetuate that TV to all the children, using the same plugin.


          I’m going to try this. I think, though, that it would be easier to just prompt the user for the new TV when duplicating resources with that TV. So if anyone has done anything somewhat similar, I’d like to see it.
            You may or may not want to use the code I write. It&#39;s probably all against the syntax rules of php and MODx. smiley

            Carpet Cleaning
            • 11927
            • 105 Posts
            This is what I came up with. It empties the TV value of the parent document that is created from the duplication and makes the children’s TV value ’TEMP’. Then when the parent document is edited and saved for the first time, the TV value of the parent is perpetuated or copied to the children.

            <?php
            /*
            
            This plugin makes select TVs blank for the document that is created when another document is duplicated.
            Then when the parent document that was just created is saved, for the first time, the select TVs are
            populated with the parent document's TV values.
            
            */
            
            /* CHANGE THESE */
            $select_tv_id = SELECT_TV_ID;// SELECT_TV_ID
            $folder_doc_id = FOLDER_DOC_ID;// SPECIFIC_FOLDER_DOC_ID
            $keywords_tv_id = KEYWORDS_TV_ID;// KEYWORDS_TV_ID
            
            
            // Doc id of the document that is going to be duplicated
            $duplicate_doc_id = $id;
            // Doc id of the document that was just saved
            $save_doc_id = $id;
            
            $e = & $modx->Event;
            
            $highest_doc_id = '';
            
            $empty = '';
            $temp = 'TEMP';
            $new_parent_id = '';
            $new_children_ids = array();
            
            
            switch ($e->name)
            {
            	case "OnBeforeDocDuplicate":
            		// IF the doc has the select TV ($select_tv_id) and if the doc's parent is Specific_Folder ($folder_doc_id): Get the highest Doc ID and store it
            		$is_in_specific_folder = false;
            		$has_select_tv = false;
            		
            		// so it only does this for the first document being duplicated
            		if( !isset($_REQUEST['first_time']) )
            		{
            			// checks if it is a child of the Specific_Folder, it isn't a grandchild, great-grandchild, but is a child
            			$sql = 'SELECT * 
            					FROM `modx_site_content` 
            					WHERE `id` = \''. $duplicate_doc_id .'\' 
            					AND `parent` = \''. $folder_doc_id .'\' ';
            			$results = mysql_query($sql);
            			if( $row = mysql_fetch_assoc($results) )
            				$is_in_specific_folder = true;
            			
            			// checks if it has the Select_TV
            			$sql = 'SELECT * 
            					FROM `modx_site_tmplvar_contentvalues` 
            					WHERE `contentid` = \''. $duplicate_doc_id .'\' 
            					AND `tmplvarid` = \''. $select_tv_id .'\' ';
            			$results = mysql_query($sql);
            			if( $row = mysql_fetch_assoc($results) )
            				$has_select_tv = true;
            			
            			// If it has the Select_TV and is a child of Specific_Folder
            			if($is_in_specific_folder == true && $has_select_tv == true)
            			{
            				// gets the highest Doc id for the site, because the current highest Doc id will be just less than the docs that will be created
            				$sql = 'SELECT * 
            						FROM `modx_site_content` 
            						ORDER BY `id` DESC 
            						LIMIT 1 ';
            				$results = mysql_query($sql);
            				if( $row = mysql_fetch_assoc($results) )
            					$highest_doc_id = $row['id'];
            				
            				// store it
            				$_REQUEST['highest_doc_id'] = $highest_doc_id;
            				
            				// gets the number of children that will be duplicated
            				$holder_arr = array();
            				$_REQUEST['number_duplicate_children'] = 0;
            				$holder_arr = $modx->getChildIds($duplicate_doc_id, 15);
            				foreach($holder_arr as $key => $value)
            				{
            					$_REQUEST['number_duplicate_children'] = $_REQUEST['number_duplicate_children'] + 1;
            				}
            				
            				// count down is used to count down to the last page that is being created
            				// on the last page that is created, do the changes
            				$_REQUEST['count_down'] = $_REQUEST['number_duplicate_children'];
            			}
            			
            			$_REQUEST['first_time'] = true;
            		}
            		else
            			$_REQUEST['first_time'] = false;
            		
            		// just for testing
            		//$modx->event->alert( 'Highest Doc ID: '. $highest_doc_id );
            		
            		break;
            	
            	case "OnDocDuplicate":
            		// just for testing
            		$holder_var = '';
            		
            		// Get the highest Doc ID if it was stored, if it wasn't stored don't do anything
            		if( isset($_REQUEST['highest_doc_id']) )
            		{
            			$highest_doc_id = $_REQUEST['highest_doc_id'];
            			
            			// if it's the first time
            			if($_REQUEST['first_time'] == true)
            			{
            				// Get the new Parent ID, it will be the Doc id just above the $highest_doc_id
            				$sql = 'SELECT * 
            						FROM `modx_site_content` 
            						WHERE `id` > \''. $highest_doc_id .'\' 
            						LIMIT 1 ';
            				$results = mysql_query($sql);
            				if( $row = mysql_fetch_assoc($results) )
            					$new_parent_id = $row['id'];
            				
            				// store it
            				$_REQUEST['new_parent_id'] = $new_parent_id;
            			}
            			else
            				$new_parent_id = $_REQUEST['new_parent_id'];
            			
            			// If it is the after the last doc was created from the duplicate and there is a $new_parent_id
            			if($_REQUEST['count_down'] == 0 && isset($_REQUEST['new_parent_id']) )
            			{
            				// Get the new children's IDs
            				$sql = 'SELECT * 
            						FROM `modx_site_content` 
            						WHERE `id` > \''. $new_parent_id .'\' ';
            				$results = mysql_query($sql);
            				while( $row = mysql_fetch_assoc($results) )
            				{
            					$new_children_ids[] = $row['id'];
            				}
            				
            				/* start changing things for the docs that were created from the duplicate */
            				$errors = '';
            				$where_description = 'WHERE ';// parent and children
            				$where_tv_keywords = 'WHERE ';// parent and children
            				$where_select_tv_children = 'WHERE ';// just children
            				
            				// just for testing
            				foreach($new_children_ids as $key => $value)
            				{
            					$holder_var .= $value .' ';
            				}
            				
            				// creates the WHERE clause of the sql statement
            				$i = 0;
            				foreach($new_children_ids as $key => $value)
            				{
            					if($i != 0)
            					{
            						$where_description .= 'OR ';
            						$where_tv_keywords .= 'OR ';
            						$where_select_tv_children .= 'OR ';
            					}
            					
            					$where_description .= '`id` = \''. $value .'\' ';
            					$where_tv_keywords .= '`id` = \''. $value .'\' ';
            					$where_select_tv_children .= '`id` = \''. $value .'\' ';
            					
            					$i++;
            				}
            				
            				// adds the $new_parent_id to the WHERE clause
            				if($i != 0)
            				{
            					$where_description .= 'OR ';
            					$where_tv_keywords .= 'OR ';
            				}
            				$where_description .= '`id` = \''. $new_parent_id .'\' ';
            				$where_tv_keywords .= '`id` = \''. $new_parent_id .'\' ';
            				
            				// makes the description empty for the created docs
            				$sql_description = 'UPDATE `modx_site_content` 
            									SET `description` = \''. $empty .'\' 
            									'. $where_description .' ';
            				// makes the keywords_tv empty for the create docs
            				$sql_tv_keywords = 'UPDATE `modx_site_tmplvar_contentvalues` 
            									SET `value` = \''. $empty .'\' 
            									WHERE `tmplvarid` = \''. $keywords_tv_id .'\' 
            									AND `contentid` IN (SELECT `id` FROM `modx_site_content` '. $where_tv_keywords .') ';
            				// makes the Select_TV empty just for the parent doc that was created
            				$sql_select_tv_id_parent = 'UPDATE `modx_site_tmplvar_contentvalues` 
            											SET `value` = \''. $empty .'\' 
            											WHERE `tmplvarid` = \''. $select_tv_id .'\' 
            											AND `contentid` = \''. $new_parent_id .'\' ';
            				// makes the Select_TV empty just for the children docs that were created
            				$sql_select_tv_id_children = 'UPDATE `modx_site_tmplvar_contentvalues` 
            											SET `value` = \''. $temp .'\' 
            											WHERE `tmplvarid` = \''. $select_tv_id .'\' 
            											AND `contentid` IN (SELECT `id` FROM `modx_site_content` '. $where_select_tv_children .') ';
            				
            				// just for testing
            				$holder_var .= '<br />'. $sql_description .'<br /><br />'. $sql_tv_keywords .'<br /><br />'. $sql_select_tv_id_parent;
            				
            				// execute the queries
            				if(mysql_query($sql_description) == false)
            				{
            					$errors .= mysql_error();
            				}
            				
            				if(mysql_query($sql_tv_keywords) == false)
            				{
            					$errors .= mysql_error();
            				}
            				
            				if(mysql_query($sql_select_tv_id_parent) == false)
            				{
            					$errors .= mysql_error();
            				}
            				
            				// if $where_select_tv_children == 'WHERE ', there are NO children, so do NOT do the query because if you do, it will change every single value for the Select_TV!!!
            				if($where_select_tv_children != 'WHERE ')
            				{
            					$holder_var .= '<br /><br />'. $sql_select_tv_id_children;
            					
            					if(mysql_query($sql_select_tv_id_children) == false)
            					{
            						$errors .= mysql_error();
            					}
            				}
            				
            				// show any errors
            				if($errors != '')
            					$modx->event->alert( $errors );
            			}
            			
            			$_REQUEST['count_down'] = $_REQUEST['count_down'] - 1;
            			
            			// just for testing
            			//$modx->event->alert( 'New Parent Doc ID: '. $new_parent_id .' Highest Doc ID: '. $highest_doc_id .'<br />Children:<br />'. $holder_var );
            		}
            		
            		break;
            	
            	case "OnDocFormSave":
            		// IF Doc has Select_TV ($select_tv_id) and if Doc's parent is $folder_doc_id:
            		// check if has children
            		$parent_select_tv_value = false;
            		$is_in_specific_folder = false;
            		
            		// checks if it has the Select_TV and gets the value if it is
            		$sql = 'SELECT * 
            				FROM `modx_site_tmplvar_contentvalues` 
            				WHERE `contentid` = \''. $save_doc_id .'\' 
            				AND `tmplvarid` = \''. $select_tv_id .'\' ';
            		$results = mysql_query($sql);
            		if( $row = mysql_fetch_assoc($results) )
            			$parent_select_tv_value = $row['value'];
            		
            		// checks if it is a child of the Specific_Folder, it isn't a grandchild, great-grandchild, but is a child
            		$sql = 'SELECT * 
            				FROM `modx_site_content` 
            				WHERE `id` = \''. $duplicate_doc_id .'\' 
            				AND `parent` = \''. $folder_doc_id .'\' ';
            		$results = mysql_query($sql);
            		if( $row = mysql_fetch_assoc($results) )
            			$is_in_specific_folder = true;
            		
            		// makes empty just for testing
            		$sql = '';
            		
            		if($parent_select_tv_value != false && $is_in_specific_folder == true)
            		{
            			// get the children ids
            			$holder_child_ids = '';
            			$new_children_ids = $modx->getChildIds($save_doc_id, 15);
            			
            			// assign the children ids to $holder_child_ids, to be used in the sql query
            			$i = 0;
            			foreach($new_children_ids as $key => $value)
            			{
            				if($i != 0)
            					$holder_child_ids .= ', ';
            				
            				$holder_child_ids .= $value;
            				
            				$i++;
            			}
            			
            			// only do update to Select_TV if the doc that was created from the duplicate has children
            			if($holder_child_ids != '')
            			{
            				$errors = '';
            				
            				/* I thought it would be best to only change the Select_TV of the children on the first save, instead of everytime */
            				$sql = 'UPDATE `modx_site_tmplvar_contentvalues` 
            						SET `value` = \''. $parent_select_tv_value .'\' 
            						WHERE `tmplvarid` = \''. $select_tv_id .'\' 
            						AND `contentid` IN ('. $holder_child_ids .') 
            						AND `value` = \''. $temp .'\' ';
            				/* you can take out
            				"AND `value` = \''. $temp .'\'"
            				to change the children Select_TV everytime, but I only want to change it the first time, see note above */
            				
            				// execute query
            				if(mysql_query($sql) == false)
            				{
            					$errors .= mysql_error();
            				}
            				
            				// show any errors
            				if($errors != '')
            					$modx->event->alert( $errors );
            			}
            		}
            		
            		// just for testing
            		//$modx->event->alert( 'Saving Doc ID: '. $save_doc_id .'<br />Website ID: '. $parent_select_tv_value .'<br />Child IDs: '. $holder_child_ids .'<br />SQL: '. $sql );
            		
            		break;
            	
            }
            
            
            
            return;
              You may or may not want to use the code I write. It&#39;s probably all against the syntax rules of php and MODx. smiley

              Carpet Cleaning
              • 11927
              • 105 Posts
              Would anyone know why it doesn’t change the ’TEMP’ to the value I want until the second time I save it?

              So this is what I do:
              - Duplicate a Resource
              - Open the new duplicate Resource to edit
              - Save the new duplicate Resource for the first time (it doesn’t perpetuate the TV value to the children)
              - Open the new duplicate Resource again
              - Save the new duplicate Resource for the second time (this time it does perpetuate the TV value to the children)

              What I want it to do is on the first time I open the new duplicate Resource and then save it, to perpetuate the TV value to the children.


              Is there something that is triggered like ’OnDocFormSaveFirstTimeAfterDuplicated’ the first time a Resource is saved that was just duplicated, instead of just the ’OnDocFormSave’?
                You may or may not want to use the code I write. It&#39;s probably all against the syntax rules of php and MODx. smiley

                Carpet Cleaning
                • 11927
                • 105 Posts
                This plugin will allow you to duplicate a document that has children and when you save the newly created document, it will perpetuate the value of the specified TV to all the children. So if you duplicate a resource, it has children, they all have the TV ’your_tv_name_here’, then when you edit and then save the duplicated resource, the value you give the TV in the parent resource will copy down to all the children.


                I updated this for Revo. (In Revo it doesn’t do the weird thing it does in Evo that I mentioned in the post just above this one.)

                <?php
                /*
                ++++WARNING++++ In order for this to be fool proof, make the select TV required.
                
                This plugin makes select TVs blank for the resource that is created when another resource is duplicated.
                Then when the parent resource that was just created is saved, for the first time, the select TVs for the 
                children are populated with the parent resource's TV values.
                
                */
                
                /* CHANGE THESE */
                $select_tv_id = SELECT_TV_ID;// SELECT_TV_ID (the id of the TV that you want to perpetuate the value down to child)
                $folder_doc_id = SPECIFIC_FOLDER_DOC_ID;// SPECIFIC_FOLDER_DOC_ID, set to 0 (zero) if not worried about limiting to a specific folder (the id of the folder the resources are in that you want to limit the perpetuating of the TV)
                $keywords_tv_id = KEYWORDS_TV_ID;// KEYWORDS_TV_ID (the id of the TV that is used for keywords)
                
                
                $e_name = $modx->event->name;
                
                $empty = '';
                $temp = 'TEMP';
                
                
                switch ($e_name)
                {
                	case 'OnResourceDuplicate':
                		$childIds = array();
                		
                		// gets the children ids because $modx->getChildIds doesn't work in OnResourceDuplicate
                		$sql = 'SELECT * 
                				FROM `z_modx_site_content` 
                				WHERE `id` >= \''. $newResource->get('id') .'\' ';
                		$results = $modx->db->query($sql);
                		$number_resources = $modx->db->getRecordCount($results);
                		while( $row = $modx->db->getRow($results) )
                		{
                			if($row['id'] != $newResource->get('id'))
                				$childIds[] = $row['id'];
                			else
                				$new_parent_id = $row['parent'];// gets the parent id because $modx->getParentIds doesn't work in OnResourceDuplicate
                		}
                		
                		if($folder_doc_id == 0 || $new_parent_id == $folder_doc_id)
                		{
                			$valid = true;
                		}
                		else
                			$valid = false;
                		
                		if($valid == true)
                		{
                			// set switch
                			$_SESSION['valid_duplicate'] = true;
                			$_SESSION['new_id'] = $newResource->get('id'); // in case person in manager decides to edit another resource inbetween duplicating and editing the newly created resource
                			$_SESSION['children_ids'] = $childIds; // saved for OnDocFormSave
                			
                			
                			// 1 = makes the select_TV empty just for the parent resource that was created
                			//
                			// 2 = makes the select_TV the same as $temp just for the children resources that were created
                			//
                			// 3 = makes the keywords_tv empty for the created resources
                			//
                			// 4 = makes the description empty for the created resources
                			
                			$select_tv = $modx->getObject('modTemplateVar', $select_tv_id);
                			$keywords_tv = $modx->getObject('modTemplateVar', $keywords_tv_id);
                			
                			$select_tv->setValue( $newResource->get('id'), $empty);// 1
                			$keywords_tv->setValue( $newResource->get('id'), $empty);// 3
                			
                			$select_tv->save();
                			$keywords_tv->save();
                			
                			foreach($childIds as $key => $childId)
                			{
                				$select_tv->setValue($childId, $temp);// 2
                				$keywords_tv->setValue($childId, $empty);// 3
                				
                				// need to save each time
                				$select_tv->save();
                				$keywords_tv->save();
                			}
                			
                			// 4
                			$sql = 'UPDATE `z_modx_site_content` 
                					SET `description` = \''. $empty .'\' 
                					WHERE `id` >= \''. $newResource->get('id') .'\' ';
                			$results = $modx->db->query($sql);
                		}
                		else
                			$_SESSION['valid_duplicate'] = false;
                		
                		break;
                	
                	
                	case 'OnDocFormSave':
                		if( isset($_SESSION['valid_duplicate']) && $_SESSION['valid_duplicate'] == true && $_SESSION['new_id'] == $id)
                		{
                			// 1 = makes the select_TV the same as $new_tv_value just for the children resources that were created
                			
                			$select_tv = $modx->getObject('modTemplateVar', $select_tv_id);
                			$new_tv_value = $resource->getTVValue($select_tv_id);// the value of select TV to give to all the children
                			
                			if( isset($_SESSION['children_ids']) )
                			{
                				$childIds = $_SESSION['children_ids'];
                				
                				foreach($childIds as $childId)
                				{
                					$select_tv->setValue($childId, $new_tv_value);// 1
                					
                					// must save everytime
                					$select_tv->save();
                				}
                			}
                		}
                		
                		if($_SESSION['new_id'] == $id)
                		{
                			// unset switch, so only perpetuates select TV down to children the first time
                			if( isset($_SESSION['valid_duplicate']) )
                			{
                				unset( $_SESSION['valid_duplicate'] );
                				unset( $_SESSION['children_ids'] );
                				unset( $_SESSION['new_id'] );
                			}
                		}
                		
                		break;
                	
                }
                
                
                return;



                -UPDATE-

                This code below will work when you have @INHERIT set as the default value for the select TV (for all the children).

                <?php
                /*
                ++++WARNING++++ In order for this to be fool proof, make the select TV required and have the default value set to @INHERIT.
                
                This plugin makes select TVs blank for the resource that is created when another resource is duplicated.
                Then when the parent resource that was just created is saved, for the first time, the select TVs for the 
                children are populated with the parent resource's TV values.
                
                */
                
                /* CHANGE THESE */
                $select_tv_id = SELECT_TV_ID;// SELECT_TV_ID (the id of the TV that you want to perpetuate the value down to child)
                $folder_doc_id = SPECIFIC_FOLDER_DOC_ID;// SPECIFIC_FOLDER_DOC_ID, set to 0 (zero) if not worried about limiting to a specific folder (the id of the folder the resources are in that you want to limit the perpetuating of the TV)
                $keywords_tv_id = KEYWORDS_TV_ID;// KEYWORDS_TV_ID (the id of the TV that is used for keywords)
                
                
                $e_name = $modx->event->name;
                
                $empty = '';
                $temp = 'TEMP';
                $inherit = '@INHERIT';
                
                
                switch ($e_name)
                {
                	case 'OnResourceDuplicate':
                		$childIds = array();
                		
                		// gets the children ids because $modx->getChildIds doesn't work in OnResourceDuplicate
                		$sql = 'SELECT * 
                				FROM `z_modx_site_content` 
                				WHERE `id` >= \''. $newResource->get('id') .'\' ';
                		$results = $modx->db->query($sql);
                		$number_resources = $modx->db->getRecordCount($results);
                		while( $row = $modx->db->getRow($results) )
                		{
                			if($row['id'] != $newResource->get('id'))
                				$childIds[] = $row['id'];
                			else
                				$new_parent_id = $row['parent'];// gets the parent id because $modx->getParentIds doesn't work in OnResourceDuplicate
                		}
                		
                		if($folder_doc_id == 0 || $new_parent_id == $folder_doc_id)
                		{
                			$valid = true;
                		}
                		else
                			$valid = false;
                		
                		if($valid == true)
                		{
                			// set switch
                			$_SESSION['valid_duplicate'] = true;
                			$_SESSION['new_id'] = $newResource->get('id'); // in case person in manager decides to edit another resource inbetween duplicating and editing the newly created resource
                			$_SESSION['children_ids'] = $childIds; // saved for OnDocFormSave
                			
                			
                			// 1 = makes the select_TV empty just for the parent resource that was created
                			//
                			// 2 = makes the select_TV the same as $temp just for the children resources that were created
                			// 2.1 = makes the select_TV the same as $inherit just for the children resources that were created
                			//
                			// 3 = makes the keywords_tv empty for the created resources
                			//
                			// 4 = makes the description empty for the created resources
                			
                			$select_tv = $modx->getObject('modTemplateVar', $select_tv_id);
                			$keywords_tv = $modx->getObject('modTemplateVar', $keywords_tv_id);
                			
                			$select_tv->setValue( $newResource->get('id'), $empty);// 1
                			$keywords_tv->setValue( $newResource->get('id'), $empty);// 3
                			
                			$select_tv->save();
                			$keywords_tv->save();
                			
                			foreach($childIds as $key => $childId)
                			{
                				//$select_tv->setValue($childId, $temp);// 2
                				$select_tv->setValue($childId, $inherit);// 2.1
                				$keywords_tv->setValue($childId, $empty);// 3
                				
                				// need to save each time
                				$select_tv->save();
                				$keywords_tv->save();
                			}
                			
                			// 4
                			$sql = 'UPDATE `z_modx_site_content` 
                					SET `description` = \''. $empty .'\' 
                					WHERE `id` >= \''. $newResource->get('id') .'\' ';
                			$results = $modx->db->query($sql);
                		}
                		else
                			$_SESSION['valid_duplicate'] = false;
                		
                		break;
                	
                
                	
                }
                
                
                return;
                  You may or may not want to use the code I write. It&#39;s probably all against the syntax rules of php and MODx. smiley

                  Carpet Cleaning