Everything posted by Mark L Bentley
-
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';
-
$.post question
I'm using $.post to send some form data to a php script. I then want to display a message in one area and refresh another are of the page. I know how to get the data from the php script and display it. Can I get two variables from the php script and display them on two different parts of the page.
-
Good with numbers?
stuck on a slice of pie. must have typed it wrong
-
Good with numbers?
42 isn't the meaning of life. It's the answer to the question.
-
Can you build a web app in less than 10 kilobytes.
Maybe we could set up a a similar competition on here, like the website of the month one.
-
Installing fonts without admin rights
I've managed to get this working on xp before. Get a usb stick, I would say at least 1gb. Download portable apps install on usb stick with open office included. You can get the minimum package and add open office. put your font here openoffice/share/fonts/truetype then in whatever program you are using import fonts form here. I've had it working with GIMP not tested on anything else. It might also work in the standard open office but not tested.
-
Jquery plugin update.
I would have thought something like facebox would work with 1.4 have you tried it?
-
Jquery plugin update.
Update your jquery.js file, download it from jquery site or link to it from google. Then see if the plugin still works. If it doesn't it might need some tweeking.
-
simple JavaScript navigator.appName script I cant get to work?
Not tested but try <head> <script type="text/javascript"> var browser = navigator.appName; var browserName = getName(); var display = document.getElementById('browser'); function getName() { if ( browser == 'netscape') { display.innerHTML("You are using Firefox"); } else if ( browser == 'Microsoft Internet Explorer' ) { display.innerHTML("You are using Internet Explorer"); } else { display.innerHTML("You are using a web browser"); } } </script> </head> <body onLoad="getName();"> <p id="browser"> </p> </body>
-
Who will take the world cup Spain or Nederlands?
Unfortunately for you sir proper football starts again in a month. Ore season friendlies have already started. There is no escape, embrace it.
-
iPhone Apps for Designers?
Try pocket monkey (free) or FTP on the go (paid) for editing files on the go.