Web Page and code file


How I can know the web page and the response code behind this page I mean the specific file for the web page to change the code in?

Can you provide a bit more detail about what you’re trying to achieve?

What I mean is: we used to edit the home page usually by editing index.php or index.html for example, but in Silverstripe I can’t know which file is behind each page.

@abuassi If I am assuming what you mean correctly, then all URL’s in SilverStripe are routed to a relevant controller (which is usually associated with a related Page object).

If you want to change the HTML Markup of a page, then you will need to change it’s relevent template in your theme (For example Page.ss, HomePage.ss).

It might be worth looking into the SilverStripe tutorials: https://www.silverstripe.org/learn/lessons/v3

Possibly: https://www.silverstripe.org/learn/lessons/v3/creating-your-first-theme?ref=hub

If you are looking to do something more specific, then (as @Tim has said), maybe you could provide more information about your issue?

As @PsychoMo says, it’s probably worth looking at the tutorials.

As a CMS, the content of a page is generally kept separate to the templates used to render it. This means that a single page template (in this case it will be a file with a .ss extension) can be used to render many pages.

In SilverStripe, the html is contained in these template files, rather than in .html files. PHP files are only used for processing the user requests, managing data and sending it to the template file to be rendered.

So, to the specific question: The home page can’t be edited via an index.php or index.html document. The content for the home page is in the CMS system (usually accessible via /admin). The template used to display this content will be determined by the page type and theme.

By default, you’ll probably find two files in the templates directory: Page.ss and Layout/Page.ss

The first of the two contains the bulk of the HTML for your site pages. This, by default, will be used as the main template. Somewhere in there, you should see a tag: $Layout This tells SilverStripe where to put the page-specific content.

SilverStripe will substitute this $Layout tag with a template from the /Layouts directory. If there is no specific page type in use, it will default to the Page.ss template. In there, you will see tags such as $Title and $Content - SilverStripe puts the relevant content elements in these places and then returns a full HTML document to the visitor.

You can create your own template files and you can also create multiple templates for different page types, so for example you could have a HomePage.ss template in the Layouts directory that had specific structures for the home page. (See the lessons linked earlier for more information)

Hopefully that helps!

Thank you so much. I’ve really appreciate your help.