Server Side Includes as a Site Template - templates

I am an ASP.NET MVC / WebForms developer by trade, so all of the websites/apps I have created in the past allowed me to use Master/Layout pages for the look/feel of all my site, while allowing me to change just the parts specific to that page.
Now, I am doing some freebie web work for a friend and I want to write it in HTML, CSS, and JavaScript using Aptana 3 so that it can be hosted wherever. Master pages are not an option for me since I am no longer in the ASP.NET/Visual Studio world, so I am looking at Server Side Includes to accomplish this. My question:
Is this a good use of SSI? I am seeing conflicting forum posts, where some say that they should be used for small pieces of the page (like a specific piece of text, time, etc). I want it to generate a large portion of my page, things like the footer, footer links, menus, banner image, etc. Basically, I want to use SSI for most of the page, and then just plug in the pieces specific to the page. Have others done this in the past with success?

If the purpose behind you choice is so that it can be hosted anywhere, then even using SSI may be restrictive since it relies on that functionality being enabled on a server.
Having said that, it is a valid option, but personally I would familiarise yourself with both the options in PHP and .NET so that you are comfortable in adapting your code to both. You are rarely going to be asked to move a site hosted on one framework to another, and if you are then you can factor changing the code into your costs.

Related

Which one is the Right Approach - Re Using Page Layouts or adding Web parts directly to pages instead of page layouts in SP 2013 online site?

I am SharePoint 2013 developer. Before asking question I would like to explain the requirement in clarity.
We are developing one O365 SharePoint online site which is having 10 different page layouts with different and some common web parts and we are reusing these page layouts by deploying a sandboxed solution which is having page layouts. These page layouts contain filter and query to display data using some condition and predefined values. By using these layouts we have to create 100+ pages. All pages will show data according to that page name and category (if it belongs any). We have not written any code to develop the site, everything is OOB feature.
We have used below feature/list/lib of SP Online 2013:
- Document Library
- Survey
- Calendar
- Lists
- Discussion forum library
- OOB Search feature
Now, I would like to know whether this is the right approach to reuse the page layouts. Or can we add webparts directly where the logic resides in the web parts and add them to the pages instead of page layouts?
Also how to deploy page layouts/pages from one server to another? Currently we are deploying everything as a feature using sandbox solution.
Could you please let me know the right approach to follow. I am asking this question because we are facing below issues:
- Sometime page layouts gets corrupted, showing nothing.
- All written filters/logic disappear when we open layouts in Designer
- Deployment is pain using Sandbox solution
Waiting for your reply.
Thanks in Advance,
Shifa Mittal
As you already know developing a custom feature which deploys your web part to the Sharepoint O365 environment is a good idea.
As you have already faced some issues with the Page layouts like got corrupted and not displaying any data is also a thing to be considered. One more thing is to open the Page layuout will require Designer as well and that is the another major thing to be consider.
If you create a webpart which has all the logic of displaying the data in it is better with several advantages of writing your code and reusing it as per your requirement.
So my vote goes with Writing you Sandboxed solution with custom web part with all the logic in it. Though it has some complications but once it is written you can manage it easily on the server and easily debug it as well.
Please correct me if I have missed something
Thanks

effects of using underscorejs templates on SEO

I have a website where I am using underscorejs.
I have many templates(underscorejs) included in the HTML.
there are cases where unnecessary templates are being read on the pages.
Does this effect the SEO rating of my site.
I have heard that Google Search engine reduces the ranking of your site if it finds no Javascript code within <script> tags.
and while specifying underscorejs templates we specify it
<script type="text/template" id="XXX"></script>
PS: I understand that readig unnecessary templates is not good , but this is done from a long time in the site and I dont intend to edit it anytime soon.
The problem I see here is that, since you are using templates that are loaded via Javascript (e.g. Underscore or Handlebars), some search engines will have problems to index your website (although there are techniques to improve indexation).
I imagine that you are building a single-page web application which is rendered in the client side via Javascript using Underscore templates; and I guess you are making AJAX calls to the server to do CRUD operations if needed.
The problem with the SEO in single-page applications is well known. Here is an interesting article (specially interesting if you are using BackboneJs).
Also here is a thread in Stackoverflow dealing with Single-page web applications and SEO.
One more resource: "Making AJAX applications crawlable" from Google.
I hope this helps.

preventing XSS/JS attacks on hosted CMS

I am working on a hosted CMS, and am thinking about allow site editors to add custom javascript and html (a much requested feature).
I am concerned that this will open up an attack vector - nasty js could make calls to the functions that our hosted CMS exposes (see the Samy worm for an example of what user scripts did to myspace), but I really want to give users control over their site (what's the point of a CMS you can't add your own clever stuff to?)
What is a good approach to fixing this issue? I can think of several which I would like commentary on, but am not going to list them for fear of the 'no list questions mods'!
I suspect that Caja is on your list, so I'll mention that this is squarely in Caja's use cases; for example, Google Sites is very like a CMS and uses Caja to embed arbitrary JS and HTML.
Caja host pages can provide arbitrary additional interfaces for use by the sandboxed content, which can include, for example, embedding widgets provided by your CMS inside the user-supplied HTML while maintaining encapsulation.
(Disclosure: I work for Google on the Caja team.)

Emulating a web browser to wrap the functionality of several similar web sites

I'm interested in emulating the functionality of a web browser in C++ so that I can create a wrapper for several web sites. Right now, the biggest issues with these sites are that they make heavy use of JavaScript that interacts with the HTML DOM. Thus, the simple solution of using curl to download the page, and something like RapidXML to parse its contents is out.
Next, I considered using something like v8 with curl, and that solves the issue of interpreting the JavaScript on the page nicely. However, it doesn't solve the issue of connecting the HTML DOM methods with the JavaScript; in other words, document.getElementById() would fail in v8.
Next, I considered WebKit, which seems like it's perfectly suited to emulate a web browser--after all, Chromium and Safari both utilize it in their web browsers. However, it's a little too complete. I don't need all of the rendering aspects it includes.
So, I'd be looking for some way to:
Make an SSL connection to a web site
Interpret the JavaScript on that web site in connection with the HTML DOM
Set the value of the username/passwords <input> fields with my username and password
Simulate clicking the "Submit" button by calling the formSubmit() function, from <input type="button" onClick="formSubmit()">
Handle the HTTP POST form action and the subsequent HTTP 301 and JavaScript redirects (accomplished using window.location)
Repeat 2-5 as needed
Besides what I've already considered, what other options do I have? Ideally, I'd want this to be extremely lightweight, without requiring linking to many libraries.
I'm primarily concerned with developing for Windows 7 64-bit.
Well, this sounds all too much like a brute-force program. Disregarding that, and since you don't seem to need to render any website, I think you should just fetch the file through cURL or something, then parse it, check for the form through using a regex, retrieve the form action, then make a request using the method taken from the <form> tag and whichever input you want.
Problem is, there would be no proper way to know when is it that you've logged in properly, unless you made some kind of per-site checking. This comes mainly from the fact that many sites use sessions rather than direct cookies or HTTP auth, and since you can't read from sessions directly, it is impossible for you to guess when the session has changed.
That's the most lightweight solution I can come up with right now.

Tracking User Actions on Landing Pages in Django

I'm developing a web application. It's months away from completion but I would like to build a landing page to show to potential customers to explain things and gauge their interest--basically collecting their email address and if they feel like it additional information like names + addresses.
Because I'm already using Django to build my site I thought I might use another Django App to serve as this landing page. The features I need are
to display a fairly static page and potentially a series of pages,
collect emails (and additional customer data)
track their actions--e.g., they got through the first two pages but didnt fill out the final page.
Is there any pre-existing Django app that provides any of these features?
If there is not a Django app, then does anyone know of another, faster/better way than building my own app? Perhaps a pre-existing web service that you can skin and make look like your own? Maybe there's the perfect system but it's PHP?--I'm open for whatever.
Option 1: Google Sites
You can set it up very very quickly. Though your monitoring wouldn't be as detailed as you're asking for.. Still, easy and fasssst!
Option 2: bbclone
Something else that may be helpful is to set up some PHP based site (wordpress or something) and use bbclone for tracking stuff on it. I've found bbclone to be pretty intense with the reporting what everyone does - though it's been a while since I used it.
Option 3: Django Flatpages
The flatpages Django contrib app is pretty handy for making static flat pages. I'd probably just embed a Google Docs Form to collect email addresses (as that's super fast and lets you get back to real work). But this suggestion would still leave you needing to figure out how to get the level of detail you want on the stats end.
Perhaps consider Google Analytics anyway?
Regardless, I suggest you use Google Analytics with everything. That'll work with anything you do really, and for all I know, perhaps you can find a way to get the stats you're really looking for out of it.