-
Models in MVC pattern
This is how I have understood it in PHP Model = classes Controller = custom logic View = what is displayed So using your example USER Model Class User{ function all_users(){ //get all the users in the database } function single_user($id){ //get a single user } } USERS View <ul> <?php echo $user_list; ?> </ul> USER view <p> <?php echo $user; ?> </p> USER Controller $user_obj = new User(); if(!isset($id)){ $user_list = $user_obj -> all_users(); include('users.php'); }else{ $user = $user_obj -> single_user($id); include('user.php'); } I hope this helps/makes sense
-
developing iPhone apps to connect to DB
Have a look at RESTful APIs. I created a basic one for use with an iPhone app. Not sure how it's done in objective-c but you do POST/GET requests depending on what you want to do.
-
TRC-Designs Latest Design
Sorry to go off topic but do you know if those shin guards are available in the uK.
-
Calling reg ex experts
Hello all. I'm no good at reg ex and just need a quick example. In javascript/jquery i'm looking to find everything in a string before the first <br /> tag and wrap it in <h1> tag. Any help appreciated thanks.
-
-
Editing strings
I hope I can explain this clearly. I have a string from a php file: <?php Header("Cache-Control: no-store, no-cache, must-revalidate"); Header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); Header("Pragma: no-cache"); header("Content-Type: text/xml;charset=iso-8859-1"); echo " <?xml version="1.0"?> <region> <id>1</id> <name>Channel Islands</name> <URL>0</URL> <popup>Currently no information for this area <BR>Check back soon.</popup> <color1>333333</color1> <color2>666666</color2> </region> <region> <id>2</id> <name>East Midlands</name> <URL>0</URL> <popup>3 Motorcycle Friendly places to stay in this region.</popup> <color1>6633FF</color1> <color2>6666FF</color2> </region> <region> <id>3</id> <name>Eastern England</name> <URL>0</URL> <popup>Currently no information for this area <BR>Check back soon.</popup> <color1>333333</color1> <color2>666666</color2> </region> "; ?> It's a lot longer than this but should be able to demonstrate with this. What I want to do is: In another file open this string, Find the popup for Eastern england edit save. I can open and save, its just locating that string which will not always be the same. Is there a way to find a string that starts with Eastern England and ends </popup>. I'm sure I should know this.
-
Javascript noob needing some help
have a look here If you need help implementing, give us a shout.
-
Urgent help needed
not working in chrome or ie7 for me. THe path to jquery.js is wrong. http://www.demo.bdfbd.com/jquery.min.js does not exist
-
Is there a way to make pages with PHP on the fly
Very basic example: store your page data in a database. e.g tag_id tag_name tag_description 1 HTML This is a page Then on your home page have a link <a href='dynamicpage.php?id=1'>HTML</a> You would then set up dynamicpage.php to get the id and then show the data associated with that id. I hope that makes a bit of sense.
-
Need help to raise money
Put it all on a horse.
-
PHP make changes to html and output source
In its most simple form you need A form to submit the text A php script to send the form to A database to store the text in A php script to output the text have a look here and here For an instant change on the page you could also use ajax If you don't need the text to be stored you could just use javascript and the text would return to it's original on refeshing the page.
-
Animate with jQuery.
maybe something like this $(".link").mouseover(function() { $("#div").slideUp("fast"); }).mouseout(function(){ $("#div").slideUp("fast", function(){ $('#div').css(original position); }); }); This way it slides up on mouseover, then up again on mouseout. When the second slide up finishes it returns to its original place.
-
Jquery modification
You might like to try the .focus() event so that it works when people are tabbing through the form as well. $("input[class*=fnpanel]").focus(function(){ if ($("#fn-panel").is(":visible")) $("#fn-panel").stop().fadeTo(300, 0); else $("#fn-panel").stop().fadeTo(300, 1); });
-
$.post question
Well what do you know it worked nicely cheers.
-
-
$.post question
That makes sense, thanks. I assume in the php i could have echo $var1."|".$var2; which would work just as well
-
$.post question
I'll try to make it a bit clearer. I've got a form that I send to a php script using $('form').submit(function(){ $.post('form_submit.php', { formField1 : variable1, formField2: variable2 }, function(data){ $('#div').html(data); }); }); The script then passes back some info in the data variable. what i'd like to do is something like this $('form').submit(function(){ $.post('form_submit.php', { formField1 : variable1, formField2: variable2 }, function(data){ $('#div').html(data.var1); $('#div2').html(data.var2); }); }); I hope that makes more sense php would be $var1 = 'hello'; $var2 = 'goodbye';