toxictoad Posted August 17, 2008 Share Posted August 17, 2008 Hi all, I'm working on my movie database and was wondering if anyone could help me with something. Where the plot of the film is long I am hiding part of it until I click 'more...' for this to work I have the following: This is the plot: In a remote mountain tribe, the young hunter, D'Leh, has found his heart's passion - the beautiful Evolet. When a band of mysterious warlords raid his village and kidnap Evolet, D'Leh is forced to lead a small group of hunters to pursue the warlords to the end of the world to save her.<a href="javascript:void(0)" onClick="toggleBlock('below', 'linkid');" id="linkid">more...</a><div id="below" class="style1" style="display:none; ">Driven by destiny, the unlikely band of warriors must battle saber-tooth tigers and prehistoric predators and, at their heroic journey's end, they uncover a Lost Civilization. Their ultimate fate lies in an empire beyond imagination, where great pyramids reach into the skies. Here they will take their stand against a powerful god who has brutally enslaved their people.</div> This is the Javascript in the php page: <script type="text/javascript"> function toggleBlock(id, linkid) { if (document.getElementById(id).style.display == 'none') { document.getElementById(id).style.display = 'block'; document.getElementById(linkid).innerHTML = 'less...' } else { document.getElementById(id).style.display = 'none'; document.getElementById(linkid).innerHTML = 'more...' } } </script> And this is the code to display the Plot: <div id="Layer3" style="position:absolute; width:270px; z-index:3; left: 234px; top: 65px;" class="style1"> <p class="style2"><?php echo nl2br(stripslashes($r[$dvd_field[2][9]])); ?></p></div> I've got a few hundrend records that already have the plots but without the code and was wondering if there's an easier way of getting this to work without me having to add the link and div code into each record manually. Is there a way to have some code in the page that cuts off the words after a certain amount automatically? What I'm trying to do is what they have on here h t t p ://uk.rottentomatoes.com/m/the_dark_knight/ where the [More] expands the rest of the text what I've got working is here h t t p ://www.phatjoints.com/mymovies/details.php?id=1 thanks in advance Link to comment https://forums.phpfreaks.com/topic/120109-more-or-less/ Share on other sites More sharing options...
Stooney Posted August 17, 2008 Share Posted August 17, 2008 Look into AJAX. That's what I would use here. Link to comment https://forums.phpfreaks.com/topic/120109-more-or-less/#findComment-618791 Share on other sites More sharing options...
unrelenting Posted August 17, 2008 Share Posted August 17, 2008 What you have looks fine. Why would you have to manually add it to each one? Why can't you just let PHP do it for you via the database? Link to comment https://forums.phpfreaks.com/topic/120109-more-or-less/#findComment-618800 Share on other sites More sharing options...
toxictoad Posted August 17, 2008 Author Share Posted August 17, 2008 What you have looks fine. Why would you have to manually add it to each one? Why can't you just let PHP do it for you via the database? Hi, I don't know how to let PHP do it for me via the database? The only know how to get it to work is to manually add <a href="javascript:void(0)" onClick="toggleBlock('below', 'linkid');" id="linkid">more...[/url]<div id="below" class="style1" style="display:none; "> to each plot at roughly the same place in the text. Ideally I was hoping to get some help with the PHP so that I didn't have to do it that Link to comment https://forums.phpfreaks.com/topic/120109-more-or-less/#findComment-618815 Share on other sites More sharing options...
unrelenting Posted August 17, 2008 Share Posted August 17, 2008 Aren't you pulling the main data from your database or is it all in html?? Link to comment https://forums.phpfreaks.com/topic/120109-more-or-less/#findComment-618817 Share on other sites More sharing options...
toxictoad Posted August 18, 2008 Author Share Posted August 18, 2008 Aren't you pulling the main data from your database or is it all in html?? Yes the data is being pulled from the database. Link to comment https://forums.phpfreaks.com/topic/120109-more-or-less/#findComment-619034 Share on other sites More sharing options...
toxictoad Posted August 18, 2008 Author Share Posted August 18, 2008 Is there a way of inserting the link info into the plot field in each table with some php code? Link to comment https://forums.phpfreaks.com/topic/120109-more-or-less/#findComment-619507 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.