Simple jQuery Accordion
Permalink
I'm new to Concrete5 and so far I've gotten far enough to create page types and figured out of how to style the auto nav how I like.
However for life of me I can't figure out how to make a jQuery accordion work.
I followed this guide and it's just not working.
http://werstnet.com/blog/creating-an-accordion-pane-in-concrete-5/...
I've made them on static sites just fine in the past, just getting them to work in a C5 is a bit confusing.
I went through that tutorial over and over, and it's seems like it's not loading the controller file.
Does anyone know what I'm doing wrong?
However for life of me I can't figure out how to make a jQuery accordion work.
I followed this guide and it's just not working.
http://werstnet.com/blog/creating-an-accordion-pane-in-concrete-5/...
I've made them on static sites just fine in the past, just getting them to work in a C5 is a bit confusing.
I went through that tutorial over and over, and it's seems like it's not loading the controller file.
Does anyone know what I'm doing wrong?
Yeah, I've see that and Easy Accordion in the Marketplace. I don't want to have to buy something, I'd rather learn.
Thank you though. :-)
Thank you though. :-)
Wow, never saw that tutorial before -- very clever!
Did you change the names of anything from how it is in the tutorial (like you used a different page type name or different attribute name)? And where exactly did you place the controller file on your server?
Did you change the names of anything from how it is in the tutorial (like you used a different page type name or different attribute name)? And where exactly did you place the controller file on your server?
Yeah, it's very clever and pretty awesome if I could get it working.
I followed the tutorial not changing any names. I was just doing as he was.
I placed the controller file in controller/page_types/ like the tutorial says. It does seem to be reading it, so I tried putting in controller/ and still nothing.
Couldn't get it working.
So I just went to route of loading jQuery UI in the header required, making a block in the footer and added HTML for my scripts. The just put the HTML for the accordion where I needed it on the page. Works perfect.
But I still want to know how to make that custom attribute work so it would be easier to add an accordion.
I followed the tutorial not changing any names. I was just doing as he was.
I placed the controller file in controller/page_types/ like the tutorial says. It does seem to be reading it, so I tried putting in controller/ and still nothing.
Couldn't get it working.
So I just went to route of loading jQuery UI in the header required, making a block in the footer and added HTML for my scripts. The just put the HTML for the accordion where I needed it on the page. Works perfect.
But I still want to know how to make that custom attribute work so it would be easier to add an accordion.
It should work. I wonder if perhaps there's a mis-spelling somewhere (especially with the word "accordion" which I often mis-spell as "accordian") -- check the controller file name, the controller class name, and the page type handle in Dashboard -> Pages and Themes -> Page Types.
That's what I thought. I checked all that. I found some errors it not reading the PHP short tags and I fixed that. Then with the part..
It will display ">value?" as the title of each section.
As for the controller, I have no idea, because it's all named correctly, no errors in the naming of accordion anywhere.
<?= $opt->value ?>
It will display ">value?" as the title of each section.
As for the controller, I have no idea, because it's all named correctly, no errors in the naming of accordion anywhere.
Hmm... yeah the short tags will mess you up if your server isn't configured properly. I would change all of those to full php tags (so <?= becomes <?php echo ).
Ahhh I forgot to add echo to that part.
Is there a proper way to load a controller file? It doesn't seem to want to load it.
Is there a proper way to load a controller file? It doesn't seem to want to load it.
Different kinds of controllers are loaded in different ways. Page type controllers are loaded the way the tutorial suggests -- a file whose name matches the page type handle (and has the class name as the CamelCase version of the page type handle followed by PageTypeController) in the YOURSITE/controllers/page_types/ directory.
If it's not loading then only reason I could think of is that there's a mis-spelling or the file isn't in the right place or you haven't set up that page type in your dashboard the proper way (or didn't choose that page type for the page in question).
I haven't come across any bugs where it doesn't load the page type controller when you do all of those things correctly, so I don't know what the problem could be.
If it's not loading then only reason I could think of is that there's a mis-spelling or the file isn't in the right place or you haven't set up that page type in your dashboard the proper way (or didn't choose that page type for the page in question).
I haven't come across any bugs where it doesn't load the page type controller when you do all of those things correctly, so I don't know what the problem could be.
I know it's not the same as making your own but have you seen this?
http://www.concrete5.org/marketplace/addons/accordion-menu/...
Hope it helps
Alex