sackbut
Posts: 2
Joined: Tue Apr 21, 2015 8:02 pm

Codeigniter 3 and Highslide

Can only find one post about CodeIgniter - that was back in Sep 2012 & the problem was the same as I am having now. The poster gave up before the problem was resolved.

So - go here :http://www.codeigniter.org.uk/ There are 3 pics on RHS, the Top one only, has the Highslide expander event wrapped around it. When you click it - it does not work ( If you go here http://www.codeigniter.org.uk/bootstrap ... e_demo.html you'll find a Bootstrap page only ( no CodeIgniter) where it works OK).

If you look at the console ( in Chrome right click page then Inspect Element, then Console ) you can see that it is failing because HS cannot locate the graphics folder. The graphics folder is in its' usual place i.e highslide/graphics. Here's the question.... How do you set hs.graphicsDir so that Codeigniter understands it so that HS can find it inside a CI page ?
MisterNeutron
Posts: 440
Joined: Sun Aug 18, 2013 11:20 am

Re: Codeigniter 3 and Highslide

I believe the problem is that your <script> tag is not properly formed. You can't use both a src attribute and also have text content. Most browsers will ignore the text content if the src is found. So, change this:

Code: Select all

<script type="text/javascript" src="http://www.codeigniter.org.uk/application/views/highslide/highslide.packed.js">
	hs.graphicsDir = "http://www.codeigniter.org.uk/application/views/highslide/graphics/";
</script>
To:

Code: Select all

<script src="http://www.codeigniter.org.uk/application/views/highslide/highslide.packed.js">
</script>
<script>
	hs.graphicsDir = "http://www.codeigniter.org.uk/application/views/highslide/graphics/";
</script>
You don't need the type attribute in HTML5 - the default type for a <script> tag is text/javascript, so there's no need to specify it.
sackbut
Posts: 2
Joined: Tue Apr 21, 2015 8:02 pm

Re: Codeigniter 3 and Highslide

Thanks for that - it was 80% of the answer ( though that javascript you correctly said was wrong, was a direct cut and paste from the Highslide examples page).

The other 20% was that one of the graphics resources is loaded from the stylesheet, using a relative URL, which Codeighniter does not like. Changed that .... and now... it all works

Thanks !
MisterNeutron
Posts: 440
Joined: Sun Aug 18, 2013 11:20 am

Re: Codeigniter 3 and Highslide

Glad you got it worked out. :)

Just out of curiosity, where is the "bad" code on the examples page? Those examples are getting pretty long in the tooth, using a 15-year-old, obsolete DOCTYPE for example, but I don't recall stumbling into something that was dead wrong. Unlikely that any errors will get fixed, however - Highslide JS is, at this point, virtually "abandonware."

Return to “Highslide JS Usage”