css with a block?

Permalink 1 user found helpful
So here where I am. I added the html for a menu that I want to create as a block. I create a html block and added the html for the menu in there. I included the css link which is this: <link href=" <?=$this->getThemePath(); ?>/menu/menu_style.css" rel="stylesheet" type="text/css" />
Doesn't link up wit the css file which is in the folder I uploaded.
Any advice? Can I have a css link within a block?

ludicrousman
View Replies:
PineCreativeLabs replied on at Permalink Reply
PineCreativeLabs
Due to the very nature of how a web page is structured, you cannot call in an external stylesheet inside the body. You will need to call it in within the header. You will then need to apply your classes (or IDs) to the block area.
PatrickHeck replied on at Permalink Reply
PatrickHeck
In your view is called view.php then just create a view.css in the same directory. It will be included in the header automatically.
Shotster replied on at Permalink Reply
Shotster
>> I added the html for a menu that I want to create as a block.

What kind of menu? How do you want it to look and behave? Can you point to an existing site as an example?


>> I create a html block and added the html for the menu in there.

So is this a static menu which you don't want to automatically adapt to a changing site hierarchy?


>> I included the css link which is this:
>> <link href=" <?=$this->getThemePath(); ?>/menu/menu_style.css" rel="stylesheet" type="text/css" />
>> Doesn't link up wit the css file which is in the folder I uploaded.

If you put that code into the text field when configuring the HTML block, it's not going to work. PHP code cannot be executed from there.


> Any advice? Can I have a css link within a block?

You can add CSS to the document head via the addHeaderITem() function call from a block CONTROLLER or by including it as described by PatrickHeck. As was mentioned in response to your previous post, you might want to look into the autonav block. You might need to create a custom template for it. That's how navigation menus are usually created in C5; but again, without more detail on the type of menu you're after, it's difficult to provide specific help.

By way of overview, C5 allows you to organize your website as a "tree" -- i.e. a hierarchy of pages which you can see and edit via the dashboard site map. Generally speaking, most navigation menus should somehow reflect that hierarchy. With an autonav block, you can display any "node" of the site tree, and you don't have to display all sub-levels.

You can create virtually any kind of menu system you can imagine, and when you edit the site map, the menu will automatically update. But again, without knowing exactly what you're after, it hard to be more specific.

-Steve