MENU item selected - menuitem

I have a menu created in ASP.NET master page. I have implemented CSS properties to menu items like hover and link, but I am not able to implement the properties for changing the color of the selected item in the menu.
Do I need to write any JavaScript or jQuery code for identifying the selected item in the menu? Please help me, as I am new to this type of menu items.

if you mean that you want to change the color of a menu item persistently (like, say, the current page tab of a navigation menu is always some particular color), you can do this in ASP by adding a class or id attribute to the menu item when it is clicked. I'm not an ASP kind of guy, but in PHP, you can do it by doing something like:
<li>page #n</li>
and then when the page in question is loaded, the navigation code should say something like:
if $_GET[page]=n then echo " class=\"selected\"" into the anchor tag.
know what i mean? I didn't type out the code for the above if statement because I'm pretty sure ASP is a little different from PHP, and you would have to translate anyway, but I hope this is helpful.
Andy
Edit: ## Here's my ASP guesswork after a brief encounter with google: ##
<li
<%
if Request.QueryString("page")==n Then
Response.Write(" class=\"selected\"")
%>
>Page #n</li>

Related

Adding HTML Text the right way in Experience editor

Our content author is more comfortable using Experience editor than the content editor and also has knowledge of HTML.
The requirement is - the author should also be able to add text - along with other components (carousel, banner, etc), or just create a whole HTML page using Rich text editor if they need to.
For eg: He will open Experience editor of a page, add a banner component and then below the banned wants to add text. (or maybe just design the whole page using HTML)
I'm handling this kind of task for the first time and here is what I did.
Create the following:
1. A template with the name "Rich Text Section", which has one field "Content" of type "Rich Text".
2. A View Rendering, "Rich Text Component", that points to a .cshtml which is a simple HTML
<div class="row">
#Html.Sitecore().Field("Content", Model)
</div>
A folder "Rich Text Sections" under Sitecore > Content > Home > Components. In this folder, the author can add only "Rich Text Section" templates.
To add text to/or design a page, the author needs to do the following.
Browse in content editor mode. Add a new item (say "LoremIpsum"), of template type "Rich Text", inside the "Rich Text Sections" folder.
Browse in Experience editor mode. Add the "Rich Text Component", set its data source to "LoremIpsum", and then write all the HTML content inside.
Here, the author has to switch to both editor modes. Please advise the better way to do this.
If you have the Insert Options set up correctly on the items in your solution, then from the Experience Editor you can use Insert Page from the Home tab on Ribbon. This will then pop up a modal showing all the Templates that have been configured as Insert Options, the same ones as if you were to right click on a node in the Content Editor and select the Insert option.
The page will be created as a child of the page you are currently on. You can navigate to different sections of the content tree by enabling the Navigation Bar option from the View Ribbon, selecting the page and selecting "Go".
EDIT: I mis-read your question. It seems you are trying to create the Datasource of the item when a component is added using the Experience Editor.
You need to set the Datasource Location and Datasource Template fields on the definition item of your Rendering:
Make sure you leave the Data source field empty on the Rendering item. Now when you add the component you will be prompted to Select the Associated Content. Your editors will be able to select existing content or create new ones.
You can read more in this blog post.

Translating theme: Add to cart button?

I've been translating a theme by simply customizing the HTML, but I've run into a problem:
The "Add to cart" button on a product page. I can translate the label on the button, but when you click the button the text changes from "Add to cart" to "Adding..." and then to "Added!".
Neither "Adding..." nor "Added!" are anywhere to be found the HTML of the theme, so I'm wondering where I should look if I want to translate those?
The "Adding", "Added" response comes from the theme's javascript - unfortunately that's hard-coded in and there's not a way to change it. You may want to try modifying another theme that doesn't use ajax to add products to your cart, like Sexy, Luna, or Nova - then you should be able to have more control over translating your store completely.

How do I localize the names of menu items in Sitecore?

I'm creating localizations--in Spanish and Chinese--for a Sitecore site. The original language is English. I've learned how to create my language-specific versions of pages. But I don't know how to change the names of the the navigation items themselves. When I preview my pages in Spanish (http://content.example.com/?sc_lang=es), for example, the page content is in Spanish, but the navigation items themselves (e.g. Home, About, Products, etc.) are still in English. Where in the Content or Page editors do I fix that?
You need to modify the "display name" of the item in the Home ribbon. Be aware that this also affects the url of the item For the chosen language.
Edit: maybe I was too quick with my answer, I probably overread something cause my suggestion changes the Url (if you have the setting "useDisplayName=true" like jammykam corrected) and the name of the item in the content tree for the specific language.
If your the names displayed in the navigation is based on the Item names, then can do as I suggested, change the display item's name for the current language and make the code look at the display name inestead of the item name.
Another option is to use a separate field for the menu-title in case you want your titles to differ from your url's.
When you say the navigation items themselves are in still in English, what do you mean? As in, the menu running along the top of the page?
If so, then you need to figure out where in the content tree those items are and then add in the relevant language versions/translations, and make sure they are not "shared" content.
#Martijn, I believe it only affects the URL is you set "useDisplayName=true" in the linkManager setting in config.
We usually add a field called MenuTitle to the base content template and then instruct our navigation controls to read from that field
For menus, we generally use a different field for the page's title and the page's navigation title. This allows for a shorter version to be specified by the author for the menu.
Once you have that, you just need to make sure you build code in your header control to find the target item of the menu link (I assume it's a general link, or some other Item reference) and pull the target item's navigation title.
When the code does this, it should automatically pull the version of that target item based on the current language, which will mean you will get your navigation title in the correct language.

How can I programatically select a sitecore content tree item and expand it?

How can I programatically select a sitecore content tree item and expand it ?
Sitecore version: 6.2
By expanding, I mean expanding the content tree item like in windows explorer ("+").
Ok, I suppose this code will be triggered from somewhere in Content Editor, e.g. by clicking the ribbon button. Then you might need something like this:
// it is up to you where to get the item from
Sitecore.Context.ClientPage.SendMessage(this, string.Concat(new object[] { "item:load(id=", item.ID.ToString(), ")" }));
Sitecore.Context.ClientPage.SendMessage(this, "item:refreshchildren");
I can't imagine the scenario when you might need this functionality, but hope this helps. :)
this might be a late reply but you can get all the side menu items via Sitecore API in a repeater or listview control within <ul>s and <li>s and then use a jQuery plug-in/CSS to [+] or [-] the side menu. I have done this on a site, if you need more information I can send you an example

How can I make Joomla 1.5 menus?

I'm making my own Joomla template, but when I check menu manager, it seems to be very confusing, because there are a lot of choices. I just need simple menu linking to my sites pages. So I need to know:
1) What kind of tag I need to insert to my template, so that it can show menus.
2) How can I link to pages on my site with that menu manager.
So, here's the five minute whirlwind tour of Joomla: You have Components, Modules, and Plugins.
Menu items link to components. This means that components are effectively "pages" in Joomla. So, you want a page to list a bunch of articles, for example? Create a menu item, and when you're asked to set it's "type" pick one the "articles" entries. Boom; you've just linked to a component.
Now, modules are odd bits and pieces of code that sit around components. Remember, the component is the "page" for all intents and purposes; modules are sidebar elements, "Related Articles" widgets and the like.
To create a new module, go to Extensions -> Module Manager and add one. Now, you can create a module that lists a batch of menu pages.
Lastly, you need someplace to put your modules on the page. The "template tag" if you're coming from Wordpres, is "". Drop that in your template on the sidebar, and change the name (the bit in parenthesis), to something like "sidebar".
Now, if you go back to the module manager, click your "Menu" widget, you should see a dropdown on the left where you can select the "position" the module should sit in. Select (or type in) "sidebar", and now that menu will be dropped into the page whereever you've placed your tag.
I would suggest you to go through the joomla 1.5 quick start guide, there you will find how to do that along with other stuff. This is the pdf file.
I'd agree with Sarfraz.
You could also check out the guides from Compass:
http://www.compassdesigns.net/joomla-tutorials/joomla-15-template-tutorial