![]() |
Background Switcher? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Background Switcher? (/showthread.php?tid=42417) Pages:
1
2
|
Background Switcher? - El Forum - 06-07-2011 [eluser]austintbiggs[/eluser] I'm trying to create a background switcher, but I'm unsure as to what approach I should take. I'm trying to avoid multiple style sheets, so should I maybe use uri segments and a redirect to referrer? or use a form for each item and make the anchor for each thumbnail the submit button sending a hidden id to php? Also I'm aiming to store some meta data for each background in a db, so I could pull information such as the artist or the name of the background from the db. I'm just stuck, can someone give me a nudge? Please and thank you [: Background Switcher? - El Forum - 06-07-2011 [eluser]adityamenon[/eluser] I like the second approach. Send a hidden id from a form using jquery. When you get the return data, set the required data like background-color and other "meta data", again using jquery. Background Switcher? - El Forum - 06-21-2011 [eluser]austintbiggs[/eluser] I've attempted to create the background switcher, but I'm not sure what I'm doing wrong. Here's a look at my code: Controller Code: public function appearance_settings() Model Code: <?php View Code: <?php echo $background;?> I'm trying to echo the correct information, before I stick it in with some css. Background Switcher? - El Forum - 06-21-2011 [eluser]toopay[/eluser] IMO, nothing wrong with your code or your implementation (or your haircut). But i will suggest more "system-defined" themes rather than "user-defined", to maintain more controlled situation. Background Switcher? - El Forum - 06-21-2011 [eluser]theprodigy[/eluser] Quote:I’ve attempted to create the background switcher, but I’m not sure what I’m doing wrong. Quote:I’m trying to echo the correct information, before I stick it in with some css.What is the problem? What is being shown when you echo $background? Background Switcher? - El Forum - 06-21-2011 [eluser]austintbiggs[/eluser] Sorry, I feel stupid, left out the important parts, oops. The problem is that no matter if I resend the data it always sets the cookie to http://ravecity.tv/beauty/images/backgrounds/avatar.jpg which is the first entry. When echoing $background, I get http://ravecity.tv/beauty/images/backgrounds/avatar.jpg Background Switcher? - El Forum - 06-21-2011 [eluser]theprodigy[/eluser] (Just for verification) Have you tried echoing the value of $url after setting it? Since it's going into the cookie value, and that is required, have you checked to make sure it's actually being set? Background Switcher? - El Forum - 06-21-2011 [eluser]austintbiggs[/eluser] I've been using Firebug and I viewed the created cookies. Every cookie ends up with the value set as http://ravecity.tv/beauty/images/backgrounds/avatar.jpg I think it might have something to do with how the form is submitted. Each element becomes a link which sends the form, but they all have the same name. The Javascript Code: [removed] The HTML Code: <div class="hidden"> Background Switcher? - El Forum - 06-21-2011 [eluser]theprodigy[/eluser] ok, I think I see your problem. Every form has the same id. When your javascript gets called, it is only submitting the first one it finds. Background Switcher? - El Forum - 06-21-2011 [eluser]austintbiggs[/eluser] Didn't see this before Quote:IMO, nothing wrong with your code or your implementation (or your haircut). But I will suggest more “system-defined” themes rather than “user-defined”, to maintain more controlled situation.What do you mean exactly? The images that are background options are handpicked, users do not upload pictures, they simply select from the options allowed. |