WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Templates, Menus & Design => Topic started by: Anlina on September 08, 2008, 08:42:39 PM

Title: Placing menus & attaching content blocks to a page
Post by: Anlina on September 08, 2008, 08:42:39 PM
Okay, there's two things I'm trying to do and I'm not sure the best way to go about it.

1. Placing a menu inline with page content.

On my page, I have my main navigation to the left. I have an optional subnavigation that should appear as a box that sits within the main content of the page (similar to an image that text wraps around.) It should appear directly below the top header & subheader and be floated right.

What is the best way to implement this? The box should only appear when there are child pages and needs to sit inside the content area, with content wrapping around it.

I understand how to use multiple menu calls, I'm just not sure how to get the menu inside my content area (I want to keep all the pages WYSIWYG, as I will not be the only person editing the content.)

2. Placing a block of content beside my main content area.

To the right of my main content area, I want to be able to place an image with a caption below it. I'd like to be able to assign certain images & captions to specific pages.

Is there a way to do this, short of just manually inserting the image and caption into the content area and then using CSS to position it correctly? I'd like to minimize the amount of html in the page, because again, there will be other people editing the text on the page, and the less there is that they can screw up the better.

----

Screenshot of the mocked up layout is attached for reference.




[gelöscht durch Administrator]
Title: Re: Placing menus & attaching content blocks to a page
Post by: Ruud on September 08, 2008, 10:45:29 PM
Hiding/showing the menu (including the surrounding div) can be done like this.

Code: [Select]
<?php 
// Submenu region, only shown when submenu&#39;s are available
ob_start();
show_menu2(1SM2_ROOT+1SM2_STARTfalse,&#39;[li][a][menu_title]</a>&#39;,&#39;</li>&#39;, &#39;<ul>&#39;);
$childmenu=ob_get_contents();
ob_end_clean();
if (
$childmenu!="") {?>

<div id="submenu">
       <?php echo $childmenu?>
</div>
<?php ?>

If there is no submenu, the div is also not sent.

For the second block of content you could simply use an extra content block.
Create your images and captions in hidden wysiwyg pages that your editors cannot see or change.
Use the section-picker (https://forum.WebsiteBaker.org/index.php/topic,10674.0.html) to add them to the pages.
Make sure the editors don't have the rights to edit the section-picker module.

Styling everything with CSS is possible, but it won't be simple ;-)

Hope this helps you further..

Ruud
Title: Re: Placing menus & attaching content blocks to a page
Post by: Anlina on September 11, 2008, 07:01:15 PM
Thank you that was very helpful. I've got the image & caption showing - now to style it with css. :)


Your code snippet works great for displaying the child menu for my first menu [1]. I tried using it to display the child menu for a second menu [2] and changed it like so:

Code: [Select]
();
show_menu2(2, SM2_ROOT+1, SM2_START, false,'[li][a][menu_title]</a>','</li>', '<ul>');

But it doesn't seem to work. Am I missing something?

Edit: Okay, got things functional using SM2_ALLMENU, but I'm still curious why I can't get it working when I specify just my second menu.
Title: Re: Placing menus & attaching content blocks to a page
Post by: Ruud on September 11, 2008, 09:30:46 PM
I think (not tested) show_menu2(2,.....) will only show when the current page is in the same tree. So a page that must be a "member" of the 2nd menu.

According to the manual the SM2_ALLMENU is made for your situation. Show all menus.

Good luck with the styling.

Ruud

Title: Re: Placing menus & attaching content blocks to a page
Post by: Anlina on September 12, 2008, 04:25:45 PM
Thanks Ruud.

Okay, I really, really, really, really want the markup for the submenu to appear below my h2 heading (so, right in the middle of the content really.)

Is there any way to do this? It would make my life infinitely simpler, since I cannot think of a single way to get the content to wrap properly around the submenu when the markup appears above everything, where as a simple float will solve my layout problems if I can stick the markup where I want it to be.

I tried putting the code snippet Ruud provided into a Code section on my page, but that doesn't work.

Any ideas? Is this possible at all with WebsiteBaker?
Title: Re: Placing menus & attaching content blocks to a page
Post by: Ruud on September 12, 2008, 04:34:04 PM
Website baker is not responsible for placing items in the correct place.
This is all done by the browser and your CSS definitions.

Is your current work available online? so we can have a look?
Without looking at what you are doing, it is very difficult to help.

Ruud
Title: Re: Placing menus & attaching content blocks to a page
Post by: Stefek on September 12, 2008, 04:39:48 PM
Quote
Is your current work available online? so we can have a look?
Without looking at what you are doing, it is very difficult to help.
Yes, that's true...


The only way I can think of could help you:
you use the
<h2><?php echo PAGE_TITLE; ?></h2>
for your H2 Hadlines.
Then your submenu code as Ruud proposed.
And then your content.
<?php page_content(); ?>

But thu you can't have custom H2's in your pages. And they are the same as the page title.

Regards,
Stefek
Title: Re: Placing menus & attaching content blocks to a page
Post by: Anlina on September 12, 2008, 05:14:50 PM
Here is one of my in progress pages that has been populated with all of the elements that could possibly appear on one page: http://scholarscanada.com/wb/pages/reading-readiness.php
Title: Re: Placing menus & attaching content blocks to a page
Post by: Stefek on September 12, 2008, 05:30:08 PM
I admire this subject and your design skills!

Did you try my suggestions?
I think this will work for you - but there is this litle limitation on choosing H2 different to the page title.

Unfortuanatly I see no other chance to do a trick on it.

Maybe someone else...

Best Regards,
Stefek
Title: Re: Placing menus & attaching content blocks to a page
Post by: Anlina on September 12, 2008, 05:37:41 PM
Thank you. :)

I did look at your suggested solution, and I think I could use the description field to add a subheader (h2) (not a great solution, probably really bad for seo) but that presents a new problem. On many pages the title and the header (h1) are the same, but on four pages the header is an image rather than having text in my h1 position.

It also might create issues with positioning the sidebar, though that would probably be easy to resolve. But the image header issue is one that I'm stuck on.

Right now, I'm thinking the best solution may be to hardcode the subnavs into a hidden page and then use the section picker module to add them to the appropriate pages in the appropriate places. Not ideal, but the best I can come up with. I don't think it will be overly problematic for updating either, as the site is going to be fairly static and not have new pages added frequently.

I just wish there was a way to do a show_menu2 call in a Code section of page.
Title: Re: Placing menus & attaching content blocks to a page
Post by: Stefek on September 12, 2008, 05:50:35 PM
I just wish there was a way to do a show_menu2 call in a Code section of page.

Thats no problem. Just do it.

You can use the module "code" (or "code2" which is more handy) and place your SM_2  Code inside.
Dont forget to cut the
Code: [Select]
<?php and the ?> off your code.

Regards,
Stefek
Title: Re: Placing menus & attaching content blocks to a page
Post by: Anlina on September 12, 2008, 06:10:54 PM
Lol, okay, that works. My, I sure wasted a lot of frustration and stress over this... not sure what I did before that caused it not to work, but I'd tried putting in the show_menu2 call into a code block earlier and it didn't work, so I just gave up on that, but it seems functional now. Thanks!
Title: Re: Placing menus & attaching content blocks to a page
Post by: Stefek on September 12, 2008, 06:22:20 PM
You're welcome.

I'm glad you found your way to WB CMS.

Best Regards,
Stefek