DMXzone Accordion Support Product Page

This topic is locked

Is it possible to create dynamic accordions with PHP/MYSQL?

Asked 26 Mar 2012 18:44:16
2
have this question
26 Mar 2012 18:44:16 Bobby Edgar posted:
I'm curious to know if it's possible to dynamically create an accordion ,add new "tabs", with PHP/MYSQl?

Replies

Replied 27 Mar 2012 07:45:33
27 Mar 2012 07:45:33 Teodor Kuduschiev replied:
Hello Bobby,

Unfortunately this is not possible.
Replied 27 Mar 2012 13:03:31
27 Mar 2012 13:03:31 Bobby Edgar replied:
Ok. Thanks Teodor. It was worth asking.
Replied 16 Apr 2012 10:53:53
16 Apr 2012 10:53:53 Jacques H replied:
I have played some around and have dynamic accordion.
You have to use the record ID (or any other number in the record) for the section number:
- make a recordset
- in the first section change "dmxAccordion1- 1" into "dmxAccordion1- <?php echo $row_Recordset1['id']; ?>"
- delete all other sections
- make repeat behavior from <H3>- tag to first </div>- tag
And voila
Replied 26 Oct 2012 19:09:06
26 Oct 2012 19:09:06 Mark Lynch replied:
Yes, this works great for the headings, (many thanks Jacques) but what about the contents - any chance of a solution from Jacques or a mediator etc?

I have tried to do a reapeat 'do' 'while' etc for the contents, but is not working? Also what about the Recordset statement to show this?

I know there would need to be two recordsets , one which shows all the titles etc, and the second recordset (in dreamweaver) which shows the contents but has a child/foreign key of thet parent 1st recordset. At the moment I don't know what to filter the second recordset on?

Any help from anyone would be very appreciated. Ideally DMXZone will reply and say that an update is coming out next week with the facility to have dynamic content - which is logical to have this facility to me?

Many thanks
Mark
Replied 27 Oct 2012 08:26:37
27 Oct 2012 08:26:37 Jacques H replied:
It's easier than that
I guess you have the <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> before the closing div.
You only need one repeat behavior for the whole thing.
Like this:
<div class="dmxAccordion" id="dmxAccordion1">
<?php do { ?>

<a href="#dmxAccordion1-<?php echo $row_Recordset1['id']; ?>"><?php echo $row_Recordset1['activiteit']; ?> </a>


<div id="dmxAccordion1-<?php echo $row_Recordset1['id']; ?>">
<p> <?php echo $row_Recordset1['omschrijving']; ?> </p>
</div>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</div>

So that is twice the ID, once for the header and once for the content-div. and just put your dynamic content in the content-div.
Replied 27 Oct 2012 08:40:30
27 Oct 2012 08:40:30 Teodor Kuduschiev replied:
Hello Mark, Jacques,

The suggestion Jacques gave is right.
The dynamic option inside the UI is not included with a purpose. If you load simultaneously say 10 tabs with content from a recordset your page will become extremely slow and heavy.
Replied 27 Oct 2012 18:07:14
27 Oct 2012 18:07:14 Mark Lynch replied:
Hi thanks Jacques and Teodor for your replies.

K, regards

Mark
Replied 28 Oct 2012 15:11:22
28 Oct 2012 15:11:22 Mark Lynch replied:
Hi Jacques,

Just a question, if you don't mind.

On your code example, there is only one recordset1 - but for mine, I was using a recordset to hold all the headings, and another recordset to hold the JOIN tables of the headings and the content (2 seperate tables)?

My problem is that its not showing each heading if I use just one recordset.

You can see example here: turtletravel.co.uk/newindex.php .

The headings should look like on this page at: turtletravel.co.uk/newindex2.php

Just wondered if I can ask this favour or contribute to you in any way via paypal or a design I can do for you?

R, Mark
Replied 28 Oct 2012 16:43:14
28 Oct 2012 16:43:14 Jacques H replied:
It looks like u need to use a nested repeat to do what you want to do. I don't quite understand why you would want to use 2 tables to make the accordion as the accordion uses a header and content to go with that header.
Could you mail me the tables at xxx and a short explanation of which field is used for what. I will play around with it tomorrow and see if I can come up with a solution.

Reply to this topic