Simple Image Gallery not displaying properly on "Page Not Found" page

Permalink Browser Info Environment
Hi Jordan,

I posted about this in the general forums (http://www.concrete5.org/community/forums/customizing_c5/display-is... )... and then realized that it might be best to post it here, in case you've encountered anything like this.

Basically, I'm using the Simple Image Gallery in the footer of my site. But it's not displaying correctly when viewed on the "Page Not Found" page... which I'm guessing is a result of pathing issues?

Thanks for any thoughts you might have on this.

- John

Type: Discussion
Status: New
arrestingdevelopment
View Replies: View Best Answer
jordanlev replied on at Permalink Reply
jordanlev
Strange... the fancybox library isn't getting loaded on your page-not-found pages. I can't imagine why this would be (and I unfortunately don't have time to do my own testing now). I am going to ask some other people about this and hopefully they will have an answer I can get back to you with.
arrestingdevelopment replied on at Permalink Reply
arrestingdevelopment
Thanks Jordan. I'll see if I can get an idea of why the Fancybox JS isn't getting loaded, too. My guess would be that it must have something to do with the on_page_view function of the controller where it calls the addHeaderItem() to add the JS and CSS:

public function on_page_view() {
   if ($this->enableLightbox) {
      $html = Loader::helper('html');            
      $bv = new BlockView();
      $bv->setBlockObject($this->getBlockObject());
      $this->addHeaderItem($html->css($bv->getBlockURL() . '/fancybox/jquery.fancybox-1.3.1.css'));
      $this->addHeaderItem($html->javascript($bv->getBlockURL() . '/fancybox/jquery.fancybox-1.3.1.pack.js'));
   }
}


... and that there must be something wrong on a "system" page like "page_not_found" with it not getting the correct path?

Here's an interesting note: if you access the page_not_found page directly, by actually typing in that address (http://tinyurl.com/7xg3vmd ), it works fine. But if you get to the page_not_found page because you typed in an invalid URL (http://tinyurl.com/7nj288p )... it doesn't!

Maybe that means something? Could it have something to do with the way C5 handles the re-direct/re-write of the URL botching the pathing?

This isn't crucial... but thanks for your help!

- John
fastcrash replied on at Permalink Reply
fastcrash
it' beacause single page i think, take a look on your other single page.
and view the sorce code if the link is exist, if not add it hardcoded

this case is same as theme switcher add-on. not work in single page when you add getByName()

how if you try direct name
$b = Block::getByName('Simple-Gallery');// your gallery block name
$bv = new BlockView();
echo  $bv->render($b, 'view');
arrestingdevelopment replied on at Permalink Reply
arrestingdevelopment
Hmmm. Maybe you're right... It would be easy enough to just hardcode the JS/CSS files into the page_not_found.php file. But the Gallery Block isn't being called by the getblockbyname() function (or at least not by that function having been hardcoded into the file). I added the block manually by editing the Page Not Found page in C5 and adding the block into the appropriate area. Of course, C5 may, on the back end, translate that into a getblockbyname() function call.

- John
arrestingdevelopment replied on at Permalink Reply
arrestingdevelopment
Just as an update... I tried adding in hardcoded links to the FancyBox CSS and JS into the header & footer of the page_not_found.php file, respectively. And... when being re-directed to that page by entering in an invalid URL, the gallery still doesn't work.

So... I'm thinking this is more of a C5 issue than something specific to the plugin: when C5 is redirecting the output for an invalid URL to the page_not_found.php page, somehow it isn't passing or allowing access to the correct pathing, or something. Because if you enter the URL to go directly to the page_not_found.php file, everything works.

Is there someplace on the forums I should post this to see if it's an issue in the core?

Thanks!

- John
jordanlev replied on at Permalink Reply
jordanlev
Yeah, I think it's a C5 issue. Your best bet is to post to the normal "Building with Concrete5" forum. I know you already posted something in the normal forum, but maybe re-phrasing this more specifically along the lines of "my block controller's on_page_view method isn't getting called on single_pages" or something like that -- and show the specific info you have here (probably best to just link to this thread actually).

Also say which version of C5 you're using.

Sorry, wish I was able to be of more help right now :(
arrestingdevelopment replied on at Permalink Reply
arrestingdevelopment
Got it, Jordan! And no need to apologize... I really appreciate all the help you provide!

I'll put up a more specific post in the general forums like you suggested.

Thanks!

- John
arrestingdevelopment replied on at Permalink Best Answer Reply
arrestingdevelopment
Hey Jordan,

Just wanted to post back with the resolution about how I got it working (see this thread:http://www.concrete5.org/community/forums/customizing_c5/single-pag... ). The final solution was that I just created a custom "header.php" to include on the "page_not_found.php" file in my theme and hardcoded the links to the CSS and JS files into it like this:

<link rel="stylesheet" type="text/css" media="screen, print" href="<?php print DIR_REL; ?>/blocks/footer_simple_image_gallery/fancybox/jquery.fancybox-1.3.1.css" />
<script type="text/javascript" src="<?php print DIR_REL; ?>/blocks/footer_simple_image_gallery/fancybox/jquery.fancybox-1.3.1.pack.js" /></script>


Inelegant. But it works! ;D

Thanks for all your help!

- John
jordanlev replied on at Permalink Reply
jordanlev
Glad you got it solved. I changed the "best answer" to your response (because it is an actual answer and not a "pass-the-buck" like mine was).

It's funny how you might get a ton of responses or you might get nothing, depending on when you post a question and who's online at the time looking.

Cheers,
Jordan
arrestingdevelopment replied on at Permalink Reply
arrestingdevelopment
LOL! Thanks... appreciate that (though I don't deserve it).

And you're right. It's funny how the activity on the forums has an ebb and flow. It's like roulette... you just never know when you post if you're going to get overwhelmed with great responses... or the sound of crickets! LOL!

It's sort of like the "treasure hunt" effect that you get by going to Costco... you just NEVER know what new, special item they're going to have available that you never knew you couldn't live without until you saw it there at a great price! ;) Makes the trip to go shopping that much more thrilling!

Hope things are settling down on your front.

Cheers!

- John

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.