Anonymoose
Anonymoose

Reputation: 2471

Sitecore serverside logic

I am brand new to Sitecore and have been asked to extend the company's existing website with some new features.

I've been reading alot on the internet and checking out the website as it is now. However I can't seem to find where to add logic on the serverside. Simular to what you would do with PHP code when a POST occurs.

I need this for multiple reasons: generating a pdf, sending an email, extracting data from Excel sheets...

FYI: We are using Sitecore version 6.x

Thank you for your time!

Upvotes: 0

Views: 194

Answers (2)

Jay S
Jay S

Reputation: 7994

The basic flow I would usually follow when looking to extend a Sitecore build I've never seen before is as follows:

  1. Find the page that needs to be extended on the public facing website. Look at the URL to get the path.
  2. Login to sitecore as an administrator and access the Content Editor.
  3. Find the content item that matches to the page by using the URL path. (Note: Sometimes the URL won't match to the path, so you might need to use Preview mode and then jump to the Content Editor using the "Edit Item" button in Page Editor)
  4. In the 'Content' pane for the content item, I would expand the "Quick Info" section and click on the "Template" link to take me to the template that is the base for the content item.
  5. Expand the now-selected template in the tree to see its children. There should be a child named "__Standard Values" in most builds.
  6. Select the "__Standard Values" node. This is where defaults are applied.
  7. With the Standard Values node selected, open the "Presentation" ribbon in the menu.
  8. Press the "Details" button in the "Layout" button group of the ribbon.
  9. A dialog is shown. This lists all the controls currently assigned to the template's presentation.

From here, you can do a few things. You can either choose to edit one of the existing controls, or add your own. If you are editing an existing one, you'll want to look at the sublayout/rendering and figure out its path in your solution and modify the matching ASCX in the .NET solution. If you have created your own, you'll need to make sure a sublayout is defined in the Sitecore database to match to your code, and then add that Sublayout to the list of controls for the page.

Upvotes: 0

Holger
Holger

Reputation: 2271

Very broad question, so the answer would be very broad.

Basically you'd be either using the Page_Load method (and checking IsPostBack) or calling your own on method, which gets run at "the end" of the life cycle (simplified).

But this is basic Asp.Net stuff and not really something that is Sitecore specific. The only thing to watch with Sitecore is if the layout/sublayout etc is cached, as this is output caching and a postback will just return the same html as before.

And if I was to do something like generate af pdf from the current page, I'd use a GET and just link to the same page, but with something in the query string that hits another Device, that does the PDF rendering. Eg. /news/2012/news1.aspx?pdf=1

Browsers handle GETs better with regards to the Back button and using a POST for something that changes data (see http://www.w3.org/2001/tag/doc/whenToUseGet-20040321#checklist )

But as I said I sound to me more like what you need to look into is standard Asp.Net

I hope this helps.

Upvotes: 1

Related Questions