How can I include sitemap breadcrumb in my Tridion page? - tridion

I used to write
<asp:SiteMapPath ID="SiteMapPath1" Runat="server" />
in my .net application to show the navigation site map breadcrumb. Can anyone please tell me how to use this type of functionality in Tridion page? Or should I use this as a user control and add it to my page?
And one more thing as you see download PDF link in the image. How can I link this text to my respective PDF file placed in building block folder? Should I write tcm id of the file(multimedia component) like this?
<a href="tcm id of file" > Download PDF </a>
Would this be the correct approach?

OK, you have 2 questions in here - these should really be 2 separate questions. Moving on.
There's nothing stopping you from using <asp:SiteMapPath> from a website that uses Tridion - as long as you have a SiteMap provider and you create the required navigation.sitemap (or whatever .NET calls it).
Alternatively, you could create your breadcrumb at publish time by determining the location of your page in the website like I explain in this post.
For your pdf download, yes, you should have a template in Tridion generating those <a tridion:href="##Component.ID##"><img src="images/pdf.png" /></a> or something like that. Don't go hard-coding your TCM Uris please.

Have a look at this article that explains how to publish a Sitemap data source XML from Tridion. You can then use it with standard .net navigation user controls.:
http://www.tridiondeveloper.com/web-sitemap

Related

Where to locate jspx files in my code

Hello All,
<div id="Main">
Admin Home
View Logging
View Cache
View Sessions
Admin Logout
</div>
Now I have the above code in my jsp file. If I try to locate the jspx files in my source code, I do not see them. Please help me by directing me on where can I find them.
FYI I am using struts 1.x, Velocity. Please let me know If I need to add more details.
If you want to search in files: Ctrl+H and then choose tab File Search.
If you want to search for resources: Ctrl+Shift+R.
If you want to search for Java types: Ctrl+Shift+T.
If you want more shortcut keys: Ctrl+Shift+L.
Also at this link you can find a list of all eclipse shortcuts
I found at this link a part of this solution

How to add background music in asp.net without bgsound and embed

How to add background music when a website loads for the first time without using embed and bgsound.I am using visual studio 2010 and these two are not supported in this.
I am developing website using master page and i want to use the code in master
page.
What is the best practice to to be able when I open my website and some music starts f sometime.I am not much expert in .net with c#.So finding some problem in it.
If browser also matters?
Regards,
suparna
Add the following code anywhere in the body of your HTML document to embed a music file and play it automatically when a visitor browses your website.
<audio src="music/yoursongname.mp3" autoplay="autoplay" loop="loop"></audio>
Change the "src" attribute so that it contains the path and filename of the music file that you want to embed.
Note: Add the "loop" attribute if you want the music file to play over and over

How do I use Google Analytics with Sitecore 6?

I know that I need to add the tracking code snippet at the bottom of all my pages, but is there a central location to do this?
Or do I need to add this tracking code to all of my templates?
I guess that I could wrap the snippet in a user control, or external .js file, and reference it on each page, but is there a global footer somewhere? The site I'm working on has about 30-40 layouts, and adding it to each one would be a pain!
Thanks in advance!
Actually, the role of a Sitecore layout is exactly this; to act as a global file that all individual page templates "derive" from.
Normally you'd stick the analytics code into the master layout, and use Sitecore sublayout/placeholder techniques to construct the various page templates you need. You would not normally need more than perhaps one or two layouts for any device you are serving content to. And I guess for most sites, the only device in use is regular web content delivery.
That being said, what you could do, is have all the layouts inherit their codebase from a common base class (inheriting from Page), and inject the google code centrally from here. Would still require you to go through all layout files however.
I have not tried the module, I think that is codebehind version. I have made this in XSLT, its pretty fast and easy to make. I have footer.xslt where I put the code that simply checks if page you are standing on uses template that I want to index and does not belong to page names that I want to exclude. Then I have an item with a custom template for Google Analytics with following memo fields.
IncludeTemplates -field contains list of templates that I want to include for analytics :
ExcludeItemsNames -field for excluding pages by item name
contains($includeTemplates, concat('|',./#template,'|')) and not(contains($excludeItemNames, concat('|',./#template,'|')))
Remember #key and #template is always in small letters
If you run many domains don't forget to add pageTracker._setDomainName("www.example.com"); in analytics script so you can separate sub-domains etc. if they use same footer.xslt
Normally we consider the actual Google code as content. Within Sitecore we normally have a settings folder, something like /sitecore/content/settings. This exists outside the root of the site. Beneath this have a settings item with a plain multi-line text field, I think the field type is memo or something similar.
Afterwards create an XSLT that renders out the content of this settings item. Something like (assuming the field is called value in the setting item):
<xsl:value-of select="sc:fld('Value','/sitecore/content/settings/footerJavaScript')" />
You may or may not need to set the disable-output-escaping attribute.
Then on the aspx page that your pages use as the template add a control that looks at the xslt rendering:
<sc:XslFile runat="server" Path="/xsl/footerJavaScript" />
The reason that we normally keep the javascript as content is this allows the client to change the analytics code without having to contact us.

How to acquire request parameter from url from Oracle Porta HTML Page Skin?

I hope any of Oracle Portal experts here could help me out regarding this question.
I have a portal template/page that is using a HTML Page Skin. The skin may looks like:
<html>
<head>
<title>#TITLE#</title>
</head>
<body>
#BODY#
</body>
</html>
By using Oracle Portal, I could add portlets (PL/SQL and Java portlet) to the body section, in its respective template/page. However there is no way that I am aware of that could enable me to add portlets to other section in the HTML Skin, eg in section.
I need to dynamically change the title with some value that I get from the page URL and query string.
eg. if the page's url is http://www.example.com/portal/page/portal/examplepagegroup/page1?param1=paramvalue
so that the title will be 'param1', and it should be done without javascript technique.
How could I get the request parameter param1 from the URL so that it will be available to the head section? I am thinking of PL/SQL code to be used here, but, I do not how to access query string of current page.
Please comment here if clarification to the question is needed. Thanks.
The page title is a static attribute of the Portal page. There is no supported way for a portlet to change the page title dynamically at runtime. The rendering engine combines the HTML from each portlet with some HTML it builds itself, and the title is part of what the renderer builds.
What is possible is to dynamically build pages with specific names by calling WWSBR_API.ADD_FOLDER (a folder is the same as a page). See So your portlet could build a page and then redirect to it.
You find the Portal 10.1.4 API at http://www.oracle.com/technology/products/ias/portal/html/plsqldoc/pldoc1014/index.html

ASP.NET MVC: How to use static HTML pages in MVC applications?

In the app I am working on, I want to allow the user to upload static HTML pages to replace the default "user profile" MVC View page. Is this possible? That is, the user uploaded html pages will totally run out of MVC, and it can include its own CSS links, etc.
Ideas? Suggestions?
Obviously the .net MVC framework handles static content already for images / css / js etc. It would just be a matter of extending that (routing?) to pass .html files through straight to IIS. That coupled with a dash of rewriting to make prettier urls should do the trick.
However, I would be very, very wary of allowing User Generated Content in the form of raw HTML uploads as you're leaving a very very wide door open. At best, you're going to wind up with people's pages full of spam/porn/adverts. At the worst, you'll be providing a gateway for people to upload cross-site scripting hacks and potentially uploading malicious content to damage your site. The could easily take an existing form on your site, hardcode a load of junk into it, and exectute it from their homepage and break a whole heap of things.
At the very least you should be parsing the uploaded content to reduce it down to just a block of content, and then wrapping that in your own etc. I would personally be much more inclined to just provide users with a nice WYSIWYG editor to edit a single block of content - any editor worth it's salt should provide you with sanitisation as to what elements it includes / excludes. Then store this content fragment in your database / on disc and have the request for a homepage go through a standard MVC controller route and load up that content.
Edit - for you request for examples
You should be able to add an Ignore rule to your routing - there will probably already be examples of these already - crack open your Global.asax file - you will want to put in a call to the routes.IgnoreRoute method :
routes.IgnoreRoute("UserPages/{*path}");
Should let IIS handle all requests for yourwebsite.com/UserPages/aUser/homepage.html - you can also play about a bit more with the wild card fragments / constraints for prettier solutions
I suggest you to make your custom ViewEngine that will allow to use static html markup with custom tags in it, that will be replaced by user info.
So, your view engine may accept something like that:
<html>
<body>
<b><user:FirstName /></b>
<b><user:LastName /></b>
</body>
</html>
and produce
<html>
<body>
<b>First Name</b>
<b>Last Name</b>
</body>
</html>
This custom markup you can store in database, for example.
You can take a look at custom ViewEngine implementations at MVC Contrib project.

Resources