Dynamically changing component reference - html

This seems simple enough but I can't quite think of how to actually do it...
In IBM Web Content Management (WCM) version 7 I have a Presentation Template (PT) which calls a Menu Component to display some content items.
I also have some (static) links on the sidebar which I want to basically just change the menu component that is being used, and that's it.
So for example...
In the PT:
[Component name="Main Page"]
When I click on a link, I want the exact same PT to be displayed except I want it to use:
[Component name="Next Page"]
Basically, Main Page and Next Page are showing the same content items, they just have different filters on them (so they appear to be different pages). The "Main Page" shows "everything" and then if you click on a link it's suppose to only show a subset of that.
I can't quite figure out how to connect the link to the PT to change it. I've thought about using JavaScript or JSP to simply rewrite the HTML, but even then I'm not sure how I set it up to say that: "if the link has been clicked, rewrite the HTML" because I'm not sure what to even point the link to, or pass through the link.
I thought about creating different content items with different PTs to link to, but there are about a dozen links (and therefore a dozen different Menu Components that I want to use), so I thought it might be better in the long run to just use 1 dynamic PT (in case the number of links grows).
It is only that one component that needs to be changed in order to display how I need for every link though.
Any ideas how to go about doing this?

So this is how I resolved this:
I created a component reference element in the content items called "menuComp" and then I set that to point to the appropriate Menu Component for each particular page.
In the presentation template, I removed the component reference and changed it to an [Element] tag which used key="menuComp".

Related

Replacing a document node on a webpage with React code using a browser extension

I have a website that has a sidebar on it with way too many elements on it and I would like to write a browser add-on (available for as many modern browsers as possible) that lets users adjust the elements on the sidebar. Luckily I have access to the original React component that is used for the sidebar. I imagined the addon would work as follows:
A settings page allows users to design their own sidebar. For this, I believe I somehow must fetch the site content (which is probably React code) execute it (?), and find the node that I want to replace. Then I grab the elements on the sidebar to fill the default sidebar that the user can then configure to their own needs. Is executing the react code to get the elements the right approach here? If so, how would I do that?
When the user goes to the web page, a script is executed that will either find the dom element and replace it and update it each time the React Dom is updated (? not sure if that is even possible) or somehow locate the component in the React script and edit that. Again, not sure if that is even possible. An alternative would be to create an empty div and populate it with my custom component while setting the display property of the original component to none.
I would really appreciate it if somebody could let me know whether what I am trying to do is even possible, whether I am on the right track, and maybe can give me some hints on where to look for further information on how to achieve such a thing.

Form layers for fields in Access

A very simple problem to which I cannot find a solution:
I have a form with 2 (will be more in future) pages. So far I have completed the first page (Main) and now I'm about to do the second page. However, some fields are showing up on both pages.
How do I "anchor" the fields to a specific page so they don't show elsewhere?
Just make sure you have pages of even height, and set for the form AutoSize to True.
Also, hide the vertical scrollbar and implement your own paging control.
1) Go to Design View
2) Cut out the fields (ctrl+X) which are in wrong place
3) Go to sheet property and manually select the desired page location
4) Insert the fields there (ctrl+V)
For some reason it didn't work for me in any other way (ie. I couldn't select my page with a simple click on the page itself, I had to select it through properties).

Displaying image content types as grids in drupal 7?

I am currently using the Views and Display Suite modules to create a page that works as an image gallery. You click on the menu button to take you to a page (the view) that has multiple links to nodes (individual galleries).
When you click these nodes, they take you into the separate page and show all images uploaded using the "event" content type that I made.
The event content type has one field (type: image) that uses a multiupload widget, allowing for multiple file uploads.
However, the images on the node are displayed within divs, so they all have their own rows basically. I would like to know if it was possible to put them all into grids, and if so; how? I tried using display suite, but I only have that one field to work with.
If you want to get a fully customized page and arrange the fields just like you want, use the theme suggestions.
For a node of type "event", as you said, it would be node--event.tpl.php. You can duplicate the code inside the base template node.tpl.php of your parent theme (or if you don't have one, of Bartik for example) to have a good starting material.
Just rearrange the div, the tags, the variables as your convenience, add some custom CSS to make your grid, and you should be done!
I hope it helps.

Using a single shared element across multiple partial views

I have a basic ASP.Net MVC 3 application which has a number of controllers and a number of actions (and subsequently views)
A common feature of the application is to show a pop-up dialog window for basic user input. One of the key features of this dialog process is a faded mask that gets shown behind the dialog box.
Each of these dialog window controls is in a separate Partial View page.
Now, some view pages may use multiple dialog boxes, and therefore include multiple partial views in them - which as is would mean multiple instances of the "mask" element.
What I am trying to find a solution for is to only need to create one instance of a "mask" element regardless of the number of dialog partial views I include, and then the script in each partial dialog will have access to this element (so basically it just needs to be on the page somewhere)
The only real idea I have come up with so far is to add the "mask" element to the master page (or in the original view page) and this will mean it only gets added once. The problem here is that it will be added even when it is not needed (albeit one small single element)
I can live with this, but I would like to know if there is a better way to handle these kinds of scenarios?
A quick idea that came to mind is some kind of master page inheritance hierarchy, So I may have a DialogMasterPage that inherits from the standard current master page. How does that sound for an approach?
Thanks
To do something like this, where each module can register their need for a certain thing in the master page, you can use HttpContext to store a flag of whether you need to write the mask div, and just set that property in each partial. At the end of the master page, if the flag is set, you can then write the mask div if its set to true.
Obviously to make this cleaner you could wrap it all in an HtmlHelper extension or something.
My initial thought is for you to use something like jQuery UI where it handles the masking for you or if you are using something custom you can load the content for the dialog via ajax then show it in the single dialog on the master page.

How to change an Editable Region to a Non-Editable Region in my Dreamweaver template

I’m working in Dreamweaver CS3. I’ve created a template and made my horizontal menu bar an editable region. I realize now that was a bad decision since I want to be able to edit the menu once and not on every page. I want to turn it back into a non editable region.
I’ve tried:
Modify>Templates>Remove Template Markup (it’s grayed out)
Modify>Templates>Detach from Template (it’s grayed out)
I’ve manually removing the markup in the code, yet it still remains editable
I don’t know what else I can do. Is this because it’s a spry menu?
If you've marked a region of your template file as editable and you want to lock it (make it non-editable in template-based documents) again, use the Remove Template Markup command.
Click the tab in the upper-left corner of the editable region to select it.
Do one of the following:
Select Modify > Templates > Remove Template Markup.
Right-click (Windows) or Control‑click (Macintosh), then select Templates > Remove Template Markup.
The region is no longer editable.
Once you move something into an editable region in DW, you will have to manually remove it from all child pages. You can certainly move the code back on the dwt file to an uneditable region, but all child pages will not retroactively edit code or text in the editable region.
This is because DW assumes that anything in an editable region is your content and thus not to be overwritten by changes to the template. Changes to stuff inside an editable region will be applied to new pages created from the template only.
So, your steps are:
1) Move the menu code back to the uneditable region in the template
2) Do a Find and Replace to remove the code from the editable region in all child pages completely in your entire site
3) Update all child pages so the menu code gets replaced in the uneditable region.