How to create "Dynamic" Breadcrumbs in Zend Navigation - zend-framework

With Zend_Navigation, I can do something like
Home > Projects > Collaborators
but What if I want something more useful
Home > Project name > Collaborator name
How can I acheive this? Is it a good idea? Possibly, there would be performance issues? Cos it got to query up the hierarchy? But whatever it is, how can I achieve this?

Example #34 shows you how to use a view partial for breadcrumbs. I'd do a foreach on $this->pages and adjust where needed
http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.navigation.breadcrumbs

The easiest way is to render the breadcrumbs and then append to this string the Collaborator name.
This works unless you don't need it in the navigation or sitemap. Otherwise, you have to add it to the container manually.
$this->navigation()
->getContainer()
->findOneByLabel('Colaborators')
->addPage(array('label'=>'name', 'uri'=>'/name'));

Maybe it's a little bit late, but since I've been struggling with this, I'm posting it just in case it can help anyone.
If you just want to change the actual label of the current page, the easiest way to do it is in this way:
$this->view->navigation()->findOneByRoute(
Zend_Controller_Front::getInstance()
->getRouter()
->getCurrentRouteName()
)
->setLabel($label);
The findOneByRoute will work charmly if you use Zend_Routes, if you don't, you can change it by findOneByX, being X is any property of the page.
Answering to the question of the OP, in this case, it would be easy to do:
$this->view->navigation()->findOneByLabel('Collaborators')
->setLabel('Collaborator'. $name);
Being $name, the name of the collaborator.
I hope this helps to those people that still use ZF1.
Greetings,

Related

Is it possible to connect image-maps to the slides?

In order to define areas of the slides as links to wherever, it would be desirable, if the "usemap" tag could be used for that.
Is that possible?
Yes, definitely. Please just try and let me know if there is any problem.

VB Hiding Child Forms

I'm making a program that involves children, kind of. I'm using form2.Owner = me instead of parenting Mdi.
I have a button on Form1 that needs to hide the child forms, or even move them to back so I can only see Form1. Is there anyway to do this? If so, I hope there's also a way to undo as well?
If you only know of a way for parenting Mdi, I'll be willing to change, as long as it can get finished.
Thanks,
Zach
"Is there anyway to do this?"
FormName.Hide()
"I hope there's also a way to undo as well?"
FormName.Show()
If you simply want to hide it momentarily from prying eyes, I suggest minimising the form.
Me.WindowState = FormWindowState.Minimized

How to programmatically change help contents in Eclipse?

I have an eclipse plugin and I would like to programmatically disable help content TOC's based on a variable I define. In a nut shell, I want to prevent some help docs from showing up in the help contents if a specific type of user is accessing the plugin.
Preferably I would like to do this in the ApplicationWorkbenchAdvisor somewhere.
One thought would be to modify the "primary" value to be false if the variable were set.
Not sure if it would work, but try using the org.eclipse.ui.activities extension point. The tutorial from Vogella tells it is possible to hide only UI elements like wizards, views and so on, but it is from 2009.. Not sure if hiding TOC is now possible. If you try it out, would be nice to give a feedback ;)

N2 CMS - Adding a piece of text to the top of every page

Am using N2 CMS and want to know how I can create an editable item that can be included in the header of every page within the site.
I just want to be able to edit this piece of text in one place and have the text appear on every page.
I understand that I need to create a "Part" but I'm not sure how to create the edit interface for this one "part"
Thanks.
Late answer but IT might help the others. You can use it as following.
#{ Html.DroppableZone(Content.Traverse.StartPage, "EDITABLEPART").Render(); }
A simpler approach (to parts) might be to:
add a property to your homepage ContentItem which is decorated with EditableTextBox or EditableFreeTextBox.
edit the homepage to set the text
then in your layout/masterpage you can simply include the output from this property
We use this technique for storing the Google Analytics tracking code against the homepage and it then gets rendered on every page.
It sounds like you need a recursive zone. Here's an example: https://github.com/jamestharpe/HereSay/blob/master/src/HereSay/Decorators/SectionalZoneDecorator.cs
Using that code, all you need to do is name your zone beginning with "Sectional" (e.g. "SectionalTopZone") and the plug-in will take care of the rest.
For an example of an editable part, you can take a look at the code here: https://github.com/jamestharpe/HereSay/blob/master/src/HereSay/Parts/HtmlContentBlock.cs

Template declaration to dynamically find views in RoR

I'm trying to separate the views for the different platforms into different subfolders.
I have done this for the layout, at the moment I have the following:
class MoviesController < ApplicationController
layout :site_layout
def site_layout
if(iphone_request?)
"iPhone/movies"
else
"movies"
end
This means that in my action methods I don't need to include :layout, however I do still need to manually include the path to the template.
format.iphone {render :template => 'movies/iPhone/index'}
Is there a way to have the same kind of layout declaration but for templates?
Thanks
Ben
You may want to extend the view_paths so that you can have a special iphone subfolder under views and override templates as necessary. See this tutorial on how to do that.
However, is there a reason you don't want to use the iphone format in the view name (show.iphone.erb) instead of making a subfolder? See martinkl's answer in your other question for details.
I might be off, but maybe it'll help - try checking prepend_view_path.