Problem when using as global block

Permalink Browser Info Environment
Hi, I've just installed Superfish. It added to my page just fine, but when I try and make it into a global block, it breaks (see attachment). Here's what I've done:

Downloaded and installed SF
Added block to homepage page
Copied block to global scrapbook and renamed to "GlobalNav"
Deleted original block from homepage
Added this code to my default.php:

$block = Block::getByName('GloblaNav'); if( is_object($block) ) $block->display();

And that's when the block breaks. It works well before I copy and make it global, but not after

I haven't got any CSS that would interfere with ULs, LIs or any similarly named DIVs, just some basic CSS.

Is this fixable? We've got a few pages to add this to, and I'd rather not be adding it to every new page the client makes. Ta!

1 Attachment

Type: Discussion
Status: Archived
Grayda
View Replies:
andrew replied on at Permalink Reply
andrew
If you're going to include superfish in the template this way, you're going to have to hard code all CSS and JS and that superfish usually automatically adds. That means adding the following items into your theme's header manually:

<link rel="stylesheet" type="text/css" href="/packages/superfish/blocks/superfish/css/superfish.css" />

<script type="text/javascript" src="/packages/superfish/blocks/superfish/js/superfish.js"></script>

That should fix that problem.
dbcom replied on at Permalink Reply
dbcom
Just an additional help note that the code should be place below this code:
<?php echo Loader::element('header_required');?>


...I just learned the hard way when placing it above the code 1) disabled editing of any block within the site, and 2) caused some hover problems with submenus.
design021 replied on at Permalink Reply
design021
still cannot figure this method out - and is not showing up after adding it to the Global Scrapbook and editing the header.php file appropriately.

Really - i don't want to have to keep adding it to pages every new page and i would like to consolidate all changes to 1 style sheet.
shadowcomputers replied on at Permalink Reply
shadowcomputers
If you are manually adding the JavaScipt and CSS to the header you might want to stop C5 from inserting the default JavaScript and CSS again if you have another block with a Superfish Nav menu in the page.

To do this you can copy root/concrete/libraries/view.php to root/libraries/view.php

You can then change the outputHeaderItems() function where it is:
foreach($items as $hi) {
  print $hi; // caled on two seperate lines because of pre php 5.2 __toString issues
  print "\n";
}


To something like this:
foreach($items as $hi) {
  if (substr_count($hi->file, 'superfish') == 0) { 
    print $hi; // caled on two seperate lines because of pre php 5.2 __toString issues
    print "\n";
  }  // End IF not superfish files
}


If you do this you will just need to ensure that your own CSS does the styling for instances of Superfish you add to the site.
KenHarvestClouds replied on at Permalink Reply
KenHarvestClouds
Grayda, I don't know if you're still trying to figure this out, but I just was looking to do the same thing. I noticed that your $block = line has GlobalNav wrong, you've reversed the al, so it's GloblaNav. It will definitely break with that typo!
MattWaters replied on at Permalink Reply
MattWaters
Another approach would be to add it to the default blocks for the Page Type you're working with.

Go to Dashboard > Pages & Themes > Page Types and then click your page's Defaults button. Place a block, save the page type, and SF should be called on every page using that template.
kimiko replied on at Permalink Reply
kimiko
Matt... After pressing the page's Default button and entering edit mode, there's nothing to press to add a block. This is incredibly frustrating when the instructions do not match what I have available to me.
MattWaters replied on at Permalink Reply
MattWaters
When you put the "Default" page in edit mode, you should see all the editable areas you usually do on your site: Add To Header, Add To Main, etc.

What theme are you using?
kimiko replied on at Permalink Reply
kimiko
We are using the "Plain Yogurt" theme. The only editable areas that show in full-width are the navbar and image header at the top. Clicking on either of these do not give me the option to "Add To" anything.

We had purchased and were using the "Camera Arts" theme, but found it had far too many restrictions, so settled on the default "Plain Yogurt" theme.
MattWaters replied on at Permalink Reply 1 Attachment
MattWaters
Which page type ae you trying to edit? Just to make sure we're talking about the same stuff, here's what I'm doing, step-by-step:

1. Go to Dashboard > Pages and Themes

2. Click "Page Types" from the top menu

3. In the row for the "Full Width" page type, I click the Defaults button

4. The page template opens in a new tab, in Edit mode.

5. I click Add to Main (or any of the editable areas) and add the block I'd like to make default.

6. I Click Exit Edit Mode from the toolbar, then Publish my Edits.

I've attached a screenshot of what it looks like when I edit the Full Width page type defaults.

If you'd like to send me a private message with your site's concrete5 admin login and password, I'd be happy to check it out.
ConcreteCMS replied on at Permalink Reply
ConcreteCMS
Attention: Since there has been no activity on this issue for two weeks, this issue has been automatically archived.

To re-open this issue, reply to this message.

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.