Answers.Body: <p>Are you opening those templates directly in the browser? When you do this, you are bypassing Craft and the browser does not know what to do with the Craft tags or how to access the database and will show the tags instead of the contents.</p>
  
  <p>Since you have got the CP working, all should be good though. If you go to the CP and click on your bold site name at the top left in the nav,  the default homepage (or yours) should get loaded. What you actually see there is the <code>index.html</code> loaded into the <code>_layout.html</code> and you should not get any twig template tags. If you go ahead now and add some made-up segment to the address in the address field of the browser <code>/xyz</code> e.g., you will see the <code>404.html</code> loaded into <code>_layout.html</code>.</p>
  
  <p>To see your templates like your visitors will see them, Craft needs to kick in. This will only happen, if you enter a pages complete url in the browser, not a template location on your disk. (If you opended the templates directly, your address will look somethin like <code>file:///Applications/MAMP/htdocs…</code> which will not work. Visible or not, your address should always begin with <code>http:// …</code>) </p>
  
  <p>Have you still got the default news section in the install? You could add 2 or 3 dummy news in the CP, and then navigate to those news entries as described above. The template that gets used to display a single news is <code>news/_entry.html</code> but <code>_entry.html</code> will never be part of the url. It is used by Craft to fill in the contents and your urls will be somtheing like <code>news/dummy-news1</code>, <code>news/dummy-news2</code>. Hope that makes it a bit clearer?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-08T19:48:28.383Z
Answers.Text: I tried viewing the pages before (including the default news pages) through Craft and by typing "http://localhost:80...etc" into the browser, but received an error message: Forbidden - You don't have permission to access files on this server. I tried moving the Craft folder into the Public folder, and changing the path to look for it in the new location but still no luck. I've been looking on other threads, and it seems like I need to modify something in the Apache HTTP config file?
Answers.UserDisplayName: Kelly Parks
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-08T21:35:37.150Z
Answers.Text: Hm, I don´t know. Today I am using MAMP Pro but I used MAMP before with other CMSes and never had to touch the HTTP config file. I would try to go back to a setting like `htdocs/craft` and `htdocs/public` or `htdocs/my-project/craft` and `htdocs/my-project/public` if you had all set up in a subfolder e.g. `my-project`. If you have modified the `.htaccess` file in `public` in the meantime undo the changes. (btw: Make sure the file is called `.htaccess` with a point before the „h“.)
Answers.UserDisplayName: Wolfram Gehring
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-08T21:35:44.550Z
Answers.Text: If you can get into your CP again, deleting the `admin/dashboard` in the browser address field should then send you to your homepage. If this is not working, can you control that this address is nevertheless present in settings > general > site-url. If it is, you still have no luck and have everything in a subfolder like `my-project`, try and add that before the index.php to the `.htaccess` in the public folder. (The complete line then is `RewriteRule (.+) my-project/index.php?p=$1 [QSA,L]` PS. Thanks @Alec for the assistance with the first answer!
Answers.UserDisplayName: Wolfram Gehring
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-11T19:16:04.897Z
Answers.Text: Hello, Thank you so much for taking the time to write these answers! I'm still having issues. Would this code in the httpd.conf file be what's blocking me? (I have apache 2.2). It seems other people have had success in changing some things in Apache files, but there are so many solutions shown for different versions I don't know which one will work.
  
  <Directory />
      Options FollowSymLinks
      AllowOverride None
      Order deny,allow
      Deny from all
  </Directory>
Answers.UserDisplayName: Kelly Parks
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-08T09:05:13.830Z
Answers.LastActivityDate: 2015-09-08T10:48:44.623Z
Answers.LastEditDate: 2015-09-08T10:48:44.623Z
Answers.UserDisplayName: Wolfram Gehring
Body: <p>I'm learning how to use Craft. I've set it up locally using MAMP (regular) on OS X Yosemite (10.10.5). Everything is working fine until I start getting into Twig templates. When I try viewing files that contain twig code in any browser, the browser shows the twig code as content (for example, I see<code>{% block main %}</code> and <code>{# comments #}</code> within the window). I'm thinking this is a MAMP issue. </p>
  
  <p>However, as I understand it, Craft itself uses Twig. If that's the case, then it wouldn't be a MAMP issue, since then both the Craft admin site and my files wouldn't work. Any hints as to where the problem lies would be greatly appreciated. Thanks!</p>
  
  <p>Update: Trying to access it through MAMP Pro to see if that makes a difference. Now I'm being blocked right after the root. Here's a pic of the error (result with localhost in the URL not the file path):
  <a href="https://i.sstatic.net/fEwyc.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/fEwyc.png" alt="enter image description here"></a></p>
  
  <p>I don't know anything about Apache -- is it safe to display my entire httpd.conf code online to see if anyone knows it's a setting in that files that's causing the issue? I'm sorry -- this question/thread is all over the place.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-08T03:46:17.593Z
Comments.Text: Are you putting your Twig templates in the `craft/templates` folder?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-08T05:21:34.250Z
Comments.Text: Yes. And in that folder, both _layout.html, 404.html and index.html show twig code.
Comments.UserDisplayName: Kelly Parks
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-09T20:38:33.263Z
Comments.Text: Can you post a screenshot of your browser and what you're seeing?
Comments.UserDisplayName: RitterKnight
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-11T22:22:44.080Z
Comments.Text: Can you go back to regular MAMP and post a screenshot of when you're seeing twig code?
Comments.UserDisplayName: RitterKnight
Tags: <templating>
Title: Twig code showing in browser
ThreadText: # Twig code showing in browser
  
  (Asked by: username_0 on 2015-09-08)
  
  I'm learning how to use Craft. I've set it up locally using MAMP (regular) on OS X Yosemite (10.10.5). Everything is working fine until I start getting into Twig templates. When I try viewing files that contain twig code in any browser, the browser shows the twig code as content (for example, I see`{% block main %}` and `{# comments #}` within the window). I'm thinking this is a MAMP issue.
  
  However, as I understand it, Craft itself uses Twig. If that's the case, then it wouldn't be a MAMP issue, since then both the Craft admin site and my files wouldn't work. Any hints as to where the problem lies would be greatly appreciated. Thanks!
  
  Update: Trying to access it through MAMP Pro to see if that makes a difference. Now I'm being blocked right after the root. Here's a pic of the error (result with localhost in the URL not the file path):
  [![enter image description here](https://i.sstatic.net/fEwyc.png)](https://i.sstatic.net/fEwyc.png)
  
  I don't know anything about Apache -- is it safe to display my entire httpd.conf code online to see if anyone knows it's a setting in that files that's causing the issue? I'm sorry -- this question/thread is all over the place.
  
  **Tags:** templating
  
  > **Comments:**
  > **username_1**: Are you putting your Twig templates in the `craft/templates` folder?  
  > **username_0**: Yes. And in that folder, both _layout.html, 404.html and index.html show twig code.  
  > **username_2**: Can you post a screenshot of your browser and what you're seeing?  
  > **username_2**: Can you go back to regular MAMP and post a screenshot of when you're seeing twig code?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2015-09-08. Score: 4
  
  Are you opening those templates directly in the browser? When you do this, you are bypassing Craft and the browser does not know what to do with the Craft tags or how to access the database and will show the tags instead of the contents.
  
  Since you have got the CP working, all should be good though. If you go to the CP and click on your bold site name at the top left in the nav, the default homepage (or yours) should get loaded. What you actually see there is the `index.html` loaded into the `_layout.html` and you should not get any twig template tags. If you go ahead now and add some made-up segment to the address in the address field of the browser `/xyz` e.g., you will see the `404.html` loaded into `_layout.html`.
  
  To see your templates like your visitors will see them, Craft needs to kick in. This will only happen, if you enter a pages complete url in the browser, not a template location on your disk. (If you opended the templates directly, your address will look somethin like `file:///Applications/MAMP/htdocs…` which will not work. Visible or not, your address should always begin with `http:// …`)
  
  Have you still got the default news section in the install? You could add 2 or 3 dummy news in the CP, and then navigate to those news entries as described above. The template that gets used to display a single news is `news/_entry.html` but `_entry.html` will never be part of the url. It is used by Craft to fill in the contents and your urls will be somtheing like `news/dummy-news1`, `news/dummy-news2`. Hope that makes it a bit clearer?
  
  > **Comments:**
  > **username_0**: I tried viewing the pages before (including the default news pages) through Craft and by typing "http://localhost:80...etc" into the browser, but received an error message: Forbidden - You don't have permission to access files on this server. I tried moving the Craft folder into the Public folder, and changing the path to look for it in the new location but still no luck. I've been looking on other threads, and it seems like I need to modify something in the Apache HTTP config file?  
  > **username_3**: Hm, I don´t know. Today I am using MAMP Pro but I used MAMP before with other CMSes and never had to touch the HTTP config file. I would try to go back to a setting like `htdocs/craft` and `htdocs/public` or `htdocs/my-project/craft` and `htdocs/my-project/public` if you had all set up in a subfolder e.g. `my-project`. If you have modified the `.htaccess` file in `public` in the meantime undo the changes. (btw: Make sure the file is called `.htaccess` with a point before the „h“.)  
  > **username_3**: If you can get into your CP again, deleting the `admin/dashboard` in the browser address field should then send you to your homepage. If this is not working, can you control that this address is nevertheless present in settings > general > site-url. If it is, you still have no luck and have everything in a subfolder like `my-project`, try and add that before the index.php to the `.htaccess` in the public folder. (The complete line then is `RewriteRule (.+) my-project/index.php?p=$1 [QSA,L]` PS. Thanks @Alec for the assistance with the first answer!  
  > **username_0**: Hello, Thank you so much for taking the time to write these answers! I'm still having issues. Would this code in the httpd.conf file be what's blocking me? (I have apache 2.2). It seems other people have had success in changing some things in Apache files, but there are so many solutions shown for different versions I don't know which one will work.  <Directory />     Options FollowSymLinks     AllowOverride None     Order deny,allow     Deny from all </Directory>  
  
  ---
  
  