We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5340
    • 1,624 Posts
    Here’s my header. I think yours is missing the <base href="[[++site_url]]" />

    <!doctype html>  
    
    <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
    <!--[if IE 7 ]>    <html lang="en" class="no-js ie7"> <![endif]-->
    <!--[if IE 8 ]>    <html lang="en" class="no-js ie8"> <![endif]-->
    <!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->
    <!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
    
    <head>
        <meta charset="utf-8">
        
        <base href="[[++site_url]]" />
        
        <title>[[++site_name]] - [[*pagetitle]]</title>
        
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        
    	<meta name="author" content="" />
    	<meta name="copyright" content="" />
    	<meta name="publisher" content="" />
    	<meta name="robots" content="index, follow" />
    	<meta name="title" content="[[*pagetitle]]" />
    	<meta name="description" content="[[*description]]"/>
        <meta name="rating" content="General" />
        <meta name="Distribution" content="Global" />
        
    
        <link rel="stylesheet" href="assets/templates/site/reset.css" />
        <link rel="stylesheet" href="assets/templates/site/site.css" />
        
        <script src="assets/templates/site/LAB.min.js"></script>
        <script src="assets/templates/site/modernizr-1.6.min.js"></script>
        
        <script>
            $LAB
            .setOptions({"AlwaysPreserveOrder":true})
            .script("[[++site_url]]assets/templates/site/jquery-1.4.4.min.js").wait()
            .script("[[++site_url]]assets/templates/site/site.js")
            ;
        </script>
        
    </head>

      • 6310
      • 16 Posts
      I tried, but no luck. It’s still not pulling any styles into the site.

        • 3749
        • 24,544 Posts
        I think @import has to be inside a <style> block:

        <style type="text/css">
            @import "URL";
        </style>
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 5340
          • 1,624 Posts
          also try @import "reset.css"; instead of @import "assets/css/reset.css"; assuming that your master style is in the assets/css/ folder
            • 36493
            • 64 Posts
            the @import paths need to be relative to the style sheet that they are in

            so as your master css file("assets/style.css") is already in the assets folder then all import paths should start from there:

            eg.
            /* Global Reset */
            @import "css/reset.css";


              |
              • 6310
              • 16 Posts
              Awesome. Thanks again for your help. I’ll give this a go tonight and let you know.

              Aside from this minor problem, I’m really liking MODX so far. I have a much larger site I want to port over to MODX, so if I can get these minor details down, it will go a lot smoother on the larger site.

              You guys have been a great help!


              K
                • 6310
                • 16 Posts
                ok - so that worked like a gem. NOW, the last thing is getting my contact form up and running.

                Like I stated earlier, I already have a baisc PHP contact form. Bob mentioned putting the code in a snippet or a snippet and a chunk.

                I’m assuming I should put the form HTML in a chunk:

                <!-- ContactForm -->
                			<div id="ContactForm">
                
                				<div id="message"></div>
                
                				<form method="post" action="contact.php" id="contactform">  
                				<fieldset>                      
                				<legend>ContactForm</legend>
                				<label for="name" accesskey="U">Your Name: <span class="required">*</span></label>
                				<input name="name" type="text" id="name" size="30" value="" /> 
                				<br />
                				<label for="email" accesskey="E">Your Email: <span class="required">*</span></label>
                				<input name="email" type="text" id="email" size="30" value="" />
                				<br />
                				<label for="comments" accesskey="C">Your Message: <span class="required">*</span></label>
                				<textarea name="comments" cols="120" rows="11"  id="comments"></textarea>
                				<br />
                				<label for="verify" accesskey="V">3 + 1 = <span class="required">*</span></label>
                				<input name="verify" type="text" id="verify" size="3" value="" style="width: 30px;" /><input type="submit" class="submit" id="submit" value="Submit" />
                				</fieldset>
                				</form>
                						
                			</div>
                			<!-- /ContactForm -->


                and then my contact form PHP in a snippet (either I can create one or cut/paste my code into the SPF form snippet):

                <?php
                
                if(!$_POST) exit;
                
                		if (!defined("PHP_EOL")) define("PHP_EOL", "\r\n");
                 
                		$name     = $_POST['name'];
                        $email    = $_POST['email'];
                        $comments = $_POST['comments'];
                        $verify   = $_POST['verify'];
                
                		if(trim($name) == '') {
                        	echo '<div class="error_message">Attention! You must enter your name.</div>';
                			exit();
                        } else if(trim($email) == '') {
                        	echo '<div class="error_message">Attention! Please enter a valid email address.</div>';
                			exit();
                	    } else if(!isEmail($email)) {
                        	echo '<div class="error_message">Attention! You have enter an invalid e-mail address, try again.</div>';
                			exit();
                        }
                		
                        if(trim($comments) == '') {
                        	echo '<div class="error_message">Attention! Please enter your message.</div>';
                			exit();
                        } else if(trim($verify) == '') {
                	    	echo '<div class="error_message">Attention! Please enter the verification number.</div>';
                			exit();
                	    } else if(trim($verify) != '4') {
                	    	echo '<div class="error_message">Attention! The verification number you entered is incorrect.</div>';
                			exit();  
                	    }
                		
                        if($error == '') {
                        
                			if(get_magic_quotes_gpc()) {
                            	$comments = stripslashes($comments);
                            }
                
                         // Configuration option.
                		 // Enter the email address that you want to emails to be sent to.
                		 // Example $address = "[email protected]";
                		 
                         //$address = "[email protected]";
                         $address = "[email protected]";
                
                         // Configuration option.
                         // i.e. The standard subject will appear as, "You've been contacted by John Doe."
                		 
                         // Example, $e_subject = '$name . ' has contacted you via Your Website.';
                
                         $e_subject = 'You\'ve been contacted by ' . $name . '.';
                
                         // Configuration option.
                		 // You can change this if you feel that you need to.
                		 // Developers, you may wish to add more fields to the form, in which case you must be sure to add them here.
                					
                		 $e_body = "You have been contacted by $name, their additional message is as follows." . PHP_EOL . PHP_EOL;
                		 $e_content = "\"$comments\"" . PHP_EOL . PHP_EOL;
                		 $e_reply = "You can contact $name via email: $email";
                					
                         $msg = wordwrap( $e_body . $e_content . $e_reply, 70 );
                         
                         $headers .= "From: $email" . PHP_EOL;
                		 $headers .= "Reply-To: $email" . PHP_EOL;
                		 $headers .= "MIME-Version: 1.0" . PHP_EOL;
                		 $headers .= "Content-type: text/plain; charset=utf-8" . PHP_EOL;
                		 $headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL;
                
                         if(mail($address, $msg, $headers)) {
                
                		 // Email has sent successfully, echo a success page.
                				
                		 echo "<div class='Succes'><p>Thank you for contacting us, $name. You will hear from us!</strong></p></div>";
                		 		 
                		 } else {
                		 
                		 echo 'ERROR!';
                		 
                		 }          
                	}
                
                function isEmail($email) { // Email address verification, do not edit.
                
                return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i",$email));
                		
                }
                ?>


                but then how do you reference the snippet or chunk in the main template?

                I’m really close and once I get this, the rest of my sites should be easy. I’m also going post a link to the new site.

                Thanks again,

                K
                  • 3749
                  • 24,544 Posts
                  Just put this in the template (or the page content field):

                  [[!SnippetName]]


                  The snippet will execute and the tag will be replaced by whatever the snippet returns (if anything).

                  As for the chunk, the usual method is to get the chunk content inside the snippet with something like this code:

                  $chunkContent = $modx->getChunk('ChunkName');





                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 6310
                    • 16 Posts
                    I re-read my post and realized I left out the most important part. .

                    I am going to use my own contact form. Where should I put the contact.php file so it send the contact form? I tried putting in the root directory, but I got an error.

                    K
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      Put it wherever you want; just make sure that it’s linked to correctly. Relative paths or URLs will be relative to the index.php file.
                        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