How to add additional top-level navigation category and subpages in TextPattern CMS? - textpattern

I am new to TextPattern CMS.
How can I add additional top-level navigation categories and subpages to our current TextPattern-based CMS and website?

You'll probably want to use a combination of Categories and Sections.
According to their site:
Categories can be used independently (to list articles from all sections in the National category, for example), or combined with sections (to list articles in section Politics with category World).
Sections are usually the topmost navigation elements of your web site. If you want a simple, automatic list of links to sections, use the section_list tag:
<txp:section_list wraptag="ul" break="li" />
This puts the links in an unordered list, so you can use CSS to alter the layout as required.
For a popup selection list, use the popup tag:
<txp:popup type="s" />
If you want more control over the content of the list (to omit certain sections, or use a specific order), the best way is with the <txp:section /> tag (requires Textpattern 4.0.2+):
<ul>
<txp:section wraptag="li" link=1 title=1 name="about" />
<txp:section wraptag="li" link=1 title=1 name="articles" />
<txp:section wraptag="li" link=1 title=1 name="news" />
<txp:section wraptag="li" link=1 title=1 name="contact" />
</ul>
If you’ve created static pages, like an about or contact page, you can link to them by linking to the associated section:
<txp:section link=1 title=1 name="about" />
<txp:section link=1 title=1 name="contact" />
Category links are specified in a similar way. There’s a category_list tag:
<txp:category_list wraptag="ul" break="li" />
The popup tag can also be used for categories:
<txp:popup type="c" />
Please note however that categories are independent of sections. Both of these tags will link to a list of articles in all sections that belong to the selected category.
For more control, you can use the category tag (also requires Textpattern 4.0.2+):
<ul>
<txp:category wraptag="li" link=1 title=1 name="products" />
<txp:category wraptag="li" link=1 title=1 name="weather" />
<txp:category wraptag="li" link=1 title=1 name="photos" />
</ul>

Related

Customize Plone view class without touching the template

If a view is registered like this, with the template definition in zcml:
<browser:page
name="original-view"
class=".original_view.View"
permission="zope2.View"
for="*"
template="original_template.pt"
/>
and i want to customize only his class in my product, is there a way to do it without customizing also the template?
You have to wrap the browser:page by <configure package='XXXX'>
That means your then in scope of this packge.
Example:
<configure package="original.package.browser">
<!-- custom view -->
<browser:page
name="original-view"
class="your.package.browser.View" <!-- Full dotted name to you custom view class -->
permission="zope2.View"
for="*"
layer="your.package.interfaces.IYourPackageLayer" <!-- You should provide a browserlayer, otherwise you got a configuration conflict -->
template="original_template.pt" <!-- template from original.package.browser -->
/>
</configure>
EDIT:
As #sdupton mentioned, I updated the example code snipped with a layer
If you can't use a layer (BrowserLayer) you can put the code, without layer attribute into a overrides.zcml
You can also specify a more precise Interface in the for attribute

TinyMCE stripping embed code in Drupal 6 using Wysiwyg module

I have a Drupal 6 installation with a Wysiwyg profile set up to use TinyMCE. The profile has the media button turned on. I have defined the Filtered HTML input format to allow the <embed>, <object>, and <param> tags and made this the default format for all roles. When you use the media button (the thing that looks like a couple frames of film) and enter a url, code like the following is generated and visible in the source:
<object width="100" height="100" data="http://youtu.be/wEWSHWp5vHM" type="application/x-shockwave-flash">
<param name="data" value="http://youtu.be/wEWSHWp5vHM" />
<param name="src" value="http://youtu.be/wEWSHWp5vHM" />
</object>
However, when you preview or save the post, the video is not rendered.
Here is the list of allowed tags:
<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><form><input><br><p><div><span><img><h1><h2><h3><h4><h5><h6><table><tr><td><thead><th><tbody><iframe><embed><object><param>
Anybody have any idea what I'm doing wrong? I found this recent post that seems to imply that you need to set TinyMCE to not use media_strict, but I can't believe you have to add a homebrew module to get embedding to work: http://drupal.org/node/368388#comment-5501684
What happens when you try embedding using 'Full HTML Filter'? You might also create a whole new input filter type for this content type.

How to move the documentactions viewlet from a viewletmanager to another?

Once again back with a Plone question.
I have Plone 4 installed and I need to show the Document action icons at the top instead of bottom. having trouble in getting this to work. can someone help.
If you just need to move that viewlet (with same class and template), first you have to register a viewlet with same class to your desired viewletmanager (let's say for ex. plone.app.layout.viewlets.interfaces.IAboveContentBody):
<browser:viewlet
name="plone.abovecontenttitle.documentactions"
manager="plone.app.layout.viewlets.interfaces.IAboveContentBody"
class="plone.app.layout.viewlets.content.DocumentActionsViewlet"
permission="zope2.View"
/>
and then add this in your genericsetup profile (file viewlets.xml) :
<?xml version="1.0"?>
<object>
<order manager="plone.abovecontentbody" skinname="Plone Default">
<!-- this will place your viewlet before all the others.
you can also use a viewlet's name for a relative position -->
<viewlet name="plone.abovecontenttitle.documentactions" insert-before="*"/>
</order>
<hidden manager="plone.belowcontentbody" skinname="Plone Default">
<viewlet name="plone.abovecontenttitle.documentactions"/>
</hidden>
</object>
More info:
http://plone.org/documentation/kb/customization-for-developers/viewlets
http://collective-docs.readthedocs.org/en/latest/views/viewlets.html

ASP.NET Custom Navigation in Master Page

All,
I am trying to decide the best way to convert my current asp.net page into a master page. This issue I have is with the navigation. I have 3 aspx pages which are essentially html with nothing flash in as yet. These are:
Home
Reports
Admin
In my current pages, the menu built using static html as follows:
<div id="nav">
<ul>
<li>Home</li>
<li>Reports</li>
<li>Admin
</li>
</ul>
</div>
The class for each li a class is currently determined in the actual html source. So in Default.aspx the class for li a href="Default.aspx" ... would point to the selected tab class in my css, tab-selected. The other classes for the rest of li a's would be tab-unselected.
Again in reports.aspx, the class for li a href="reports.aspx" ... would point to the selected tab class in my css, tab-selected. The other classes for the rest of li a's would be tab-unselected.
My CSS is displaying the menus perfectly with the above.
I then thought I would try moving to Master pages. So I copied the above into the master page. This looks ok but the problem is as the navigation is in the Master page, how can I change the highlight the current page in the navigation.
Then I thought I would try and use the control and put the above navigation items in it. When I ran the navigation was rendered as a table and so completely broke my css. I thought tables were bad in terms of laying out things like menus and you should use unordered lists?
Question is, what is the best way to implement my navigation with ASP.NET?
Thanks
Andez
If you want to use your html list to display your navigation but style your list items using CSS then you could use this technique.
Use inline code blocks such as (assuming VB)
<% If Page.Request.Path.Contains("Default.aspx") Then %>
<li class="selected">
<% Else %>
<li>
<%End If%>
Home</li>
You would need an IF statement for each page and the code will look a bit scrappy. I'm not saying it's the best way but basically if you are using a single piece of html for you menu (but it in the Masterpage or a Control) you will need to use some logic code somewhere for the html to be different on each page. You could do this in the code-behind as well but adding some inline code blocks is the perhaps the easiest/quickest way. You could get more funky and write a helper class that wraps it all up in a select statement and just call
MenuHelper.RenderLink("Default.aspx")
but that will take more work - give me a shout if fancy trying this approach instead.
As for why your tables broke I don't know. My opinion would be if you want to use tables and your site/users won't suffer from it then go ahead - but if you have to consider mobile devices and screen readers etc then it is my understanding that tables will be harder to navigate. It's really up to you!
Cheers
Came across the following link:
http://forums.asp.net/t/1626206.aspx
Version 4.0 of the .NET Framework has some nice changes to the asp:Menu control. One of them is to render as a list. Yay! So for now I have moved from VS2008 to VS2010 Express.
After a little fiddling around I am now using a site map with an asp:Menu within a Master page as follows:
Web.sitemap
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="" title="" description="">
<siteMapNode url="Default.aspx" title="Home" description="" />
<siteMapNode url="reports.aspx" title="Reports" description="" />
<siteMapNode url="administration.aspx" title="Administration" description="" />
<siteMapNode url="ChildPage.aspx" title="Master Template" description="" />
</siteMapNode>
</siteMap>
Site.master
...
<head runat="server">
<link rel="stylesheet" type="text/css" href="styles/mystyle.css" />
</head>
<body>
<form id="Form1" runat="server">
<div id="header">
<div id="nav">
<asp:SiteMapDataSource id="nav1" runat="server" />
<asp:Menu ID="main-menu" runat="server" DataSourceID="nav1"
Orientation="Horizontal" StaticSelectedStyle-CssClass="tab-selected"
CssClass="nav"
StaticDisplayLevels="2" IncludeStyleBlock="False" RenderingMode="List" >
</asp:Menu>
</div>
</div>
<asp:ContentPlaceHolder ID="MainContent" runat="server" />
</form>
</body>
The thing with the Site Map is that you are required to have 1 top level siteMapNode which I leave as empty. StaticDisplayLevels is set to 2 in the asp:Menu, so the list is rendered as follows:
<ul class="level1">
<li><a></a></li>
<li><a class="level2 selected" href="/Web%20Portal/Default.aspx">Home</a></li>
<li><a class="level2" href="/Web%20Portal/reports.aspx">Reports</a></li>
<li><a class="level2" href="/Web%20Portal/administration.aspx">Administration</a></li>
<li><a class="level2" href="/Web%20Portal/ChildPage.aspx">Master Template</a></li>
</ul>
As you can see it puts the top level siteMapNode as the first item in the list. Which I do not want. To work around this I hide the element using the following CSS.
#nav li:first-child a
{
display: none;
}
Everything is now looking nice and very similar to the static html pages.
Andez
May be the solution I am trying to provide is not optimized but worked for me.
In the static HTML Menu in the Master page, have all the "li" tag with the ID as of the Page Name.
<ul>
<li ID="home"><a href="home.aspx">Home</li>
<li ID="About"><a href="about.aspx">About</li>
<ul>
Then in the Master Page use JQuery to get the Page Name. Some thing like
$(function () {
var filePath = window.location.pathname;
var fileName = filePath.substr(filePath.lastIndexOf("/") + 1);
var name = fileName.split('.');
var page_name = name[0];
$('#' + page_name).addClass("active"); // Add the CSS class which sets the active Menu
});
In CSS do something like
.active
{
background=#000;
color=#fff;
}
I hope this helps..

Help with ASP.NET 4.0 routing and subfolders

If I use routing with 2 query parameters, like this:
System.Web.Routing.RouteTable.Routes.MapPageRoute("HomeRoute", "home/{f1}/{f2}", "~/Home.aspx");
My image does not appear on my Home.aspx page:
<img src="~/img/img.jpg" /> or <img src="img/img.jpg" />
But it does appear when I access the http://localhost:3760/Website/Home.aspx URL
I tried using Routing.Ignore with no luck. I look for a solution wich should work for an unlimited number of subfolders: "home/{f1}/{f2}/.../{fn}"
The problem is raised by ASP.NET routing module. The image will show if I type <img src="../../img.jpg" /> but this goes further to <img src="../../../img.jpg" /> if I have "home/{f1}/{f2}/{f3}" on the routing rule
Well i can see that <img src="~/img/img.jpg" /> is wrong
it should be <img src="<%=Page.ResolveClientUrl(~/img/img.jpg)%>" />
This is because ~ is an asp symbol, not a html symbol.
Unfortunately i do not know if this is your actual problem

Resources