-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
[SOLVED] Calling a function based on a var from within a class method?
Adam replied to Adam's topic in PHP Coding Help
sorted it boys! if (is_callable($this->$func())) { call_user_func($this->$func()); } else { die('Unable to call function: ' .$func); } -
Confsuing stuff! Basically say a function name is passed within the URL, for example: "demoFunction" .. this is then collected from within the class construct method and used to try and call a function, using the php functions "is_callable" and "call_user_func" .. however as it points to another method within a class, how would I go about doing that? I've tried the following: if (is_callable($func)) { call_user_func($func); } else { die('Unable to call function: ' .$func); } if (is_callable($this->$func)) { call_user_func($this->$func); } else { die('Unable to call function: ' .$func); } if (is_callable($this->func)) { call_user_func($this->func); } else { die('Unable to call function: ' .$func); } if (is_callable('$this->'.$func)) { call_user_func('$this->'.$func); } else { die('Unable to call function: ' .$func); } Didn't expect much from the last one! .. The $func var is set within the __construct method so there's no need to have $this->func to call the value of $func .. Hopefully that makes sense, and someone knows the soloution?? Cheers for any help! Adam
-
As Andy said I wouldn't rely on it for security... But a quick search on google found: http://www.google.co.uk/search?q=javascript+strip+html+tags Adam
-
Hah sorry. Guess it weren't the clearest description err.. I think I've found a way to sort it out now so don't worry.. Cheers anyway though pal!
-
Ah no it's not the actual centering that's the problem. The way it's done uses a body background image to create the sadow effects on the side. The reason I can't simply set it as the background for the container div is because of the strip spanning all the way across which makes the containing div the entire width of the page. I'm trying to find a way of doing it without having to have it specific to any left margin... but every way I think of doing it there's something that just doesn't work well. Anybody encountered this before??
-
A'haa .. after a nights sleep it came to me.. function loadImage(imgsrc) { if (document.images) { preloadImg = new Image; preloadImg.src = imgsrc; } ti = setInterval("doSomething();", 1000); } function doSomething() { if (preloadImg.complete == 0) { return false; } alert('Image has been loaded!'); clearInterval(ti); } ... incase anyone struggles with the same problem. Adam
-
Well to be honest.. After some thinking I'm not going to be altering the width all that much. I reckon an 800px ish wide design would be simply too much space. I think the way it is now fills it nicely and gives it a bit of a unique look. My main aim at the moment is to make it dead centre. When doing the CSS I made it at a set width from the left, which isn't all that good.. Thanks for the replies though guys, I appreciate the feedback... - oh and cheers for the spelling mistake. I've corrected it now and all the 'interest' words have been changed. The text isn't the final draft yet, mainly needed something to fill it up. Adam
-
Hi all. I'm in the process of setting up a script somewhat like a gallery.. Basically I'd like to click a thumbnail, then load another, larger image. I've set up a neat looking "loading" sign to say it's now loading the image into cache.. but what I would like to know is how I could 'loop until image loaded' .. sort of speak.. so load the images in real-time.. then move on with the script.. I've done a lot of googling but now found much thats any good... Bin trying for a while so might just be too tired to think straight. silly thing is i've done it before just can't remember how :S Could anybody help me out? Cheers! Adam
-
Cheers for all the replys. Taken into account what you've all said.. And no the links don't quite work yet. I'm setting up an impressive piece of javascript to handle that.. but for those without js, the alternative will be running soon - which i'm going to use as the norm' for now.. Shall reply with an updated site soon... by the way the contact page is now done with some solid validating and security. Cheers again! Adam
-
Right okay, cheers guys! I'll get to work on making it thicker. The idea came from several sites I've seen where they've used a thin design, and i liked 'em! But if the general opinion of people is "too thin" I guess that's what potential employers would think too... Yeah cheers for heads up. Non-JS users will be something I take into consideration once I move onto the JS side of things. Oh and cheers for grammer mistakes CroNiX! After re-reading it this morning what you said about 'interest' stood out a mile... Shall show you an updated site soon! Thanks again! Adam
-
Just finished designing my online portfolio... I've not moved on to the JS or PHP yet but before I continue would just like a bit of feedback on the design side.. http://www.adamswork.net/ I've gone for a sort of simplistic, sylish look :S I'm terrible at design so want to feel comfortable with it before I continue... I've made the code as SEO friendly and accessible as I could... Also on the index.php page, there's some HTML in the source that isn't displayed onscreen yet because it's a theme feature I'm planning to implement once I move on to the JS + PHP... I would appreciate any and all feedback.... Cheers! Adam!
-
Need to see some code mate... Adam
-
[SOLVED] Problem verifying usernames that start with a number.
Adam replied to A2xA's topic in PHP Coding Help
If you're going to "users/username" it's probably a problem in your .htaccess file .. you use the file to create 'friendly URLs'. I imagine there's a regular expression in there that only allows letters? Try having a look for it.. should be in your root directory.. Adam -
Yeah perhaps a little too minimilistic? Perhaps try and add a dash of colour and a few more pages and I reckon you'll have something lookin much more appearling. When I first went on it took a few seconds to actually realise where the nav would be. Perhaps need to make that stand out a bit more? The transparent gradient's good - have to show me how to do that - but I think it's a little too dark compared to the rest of the page... Adam
-
[SOLVED] Sending a PHP variable to a JS script
Adam replied to mark110384's topic in Javascript Help
Cronix's idea is probs best way to go, but I made a silly mistake before, replace: var str = searchReq.responseText.split('|'); with: var str = x.split('|'); -
Tell me if I get this wrong... The user fills out the form you showed me before .. the information is then passed on to the script .. which then sends it to paypal. The amount that should be appearing on paypal, is the amount entered in the form? If that's right, then I'm not giving you bad advice as the input named: "formtext1" which is accessed in the PHP script using $_POST['formtext1'] .... is not included in the form. Therefore the amount they enter, is not being sent to the PHP script, and not sent to paypal .. as it's not included in the form! I think you have misread what I've been trying to say... Adam
-
okay try adding to the top of the PHP script: $test = $_POST['formtext1']; die('FORM VALUE IS: ' .$test); is there any value yet?
-
Put: <input name="formtext1" type="text" style="position:absolute;width:105px;left:351px;top:89px;z-index:0"> ... within your HTML form tags: <form action="paypal.php" method="post"> <input name="formbutton1" type="submit" value="Submit" style="position:absolute;left:372px;top:120px;z-index:2"> </form> ... like the other input ^ is. This will then send the value when you submit the form and will be accessed by $_POST['formtext1']; so if you still have everything setup how we said before (however not including the die() function I showed you) then it should work now with no problems. Adam
-
you have the "formtext1" outside of the form tags...
-
Bit of a strange way of doing it (sessions)? Could make it much more flexible and put all the code to output into a function, like: template.php <?php function writeHeader($title) { ?> <html> <head> <title><?php print $title; ?></title> .... ... ... <?php } function writeFooter() { ?> ... ... </body> </html> <?php } ?> somefile.php <?php include 'template.php'; writeHeader('Homepage | Mysite.com'); ?> <div>Your page content here...</div> <?php writeFooter(); ?> What I used once, and is fairly simple compared to something like SMARTY templates, or other template engines... Adam
-
If the page is going blank it means there's nothing in $_POST['formtext1'] .. post you form code up aswell..
-
Sorry, I'll explain better. At the very top of the script, use: die($_POST['formtext1']); ...straight after the PHP tag. that should show only the value of 'formtext1' .. if it does, remove it and then use the following code to 'add the field'.. $p->add_field('amount', $_POST['formtext1']); My mistake before I didn't see the added "echo" in there... Any luck?
-
should do if you change the extension to .php .. something.inc.php .. that should work...
-
Nah that's answered my question about the form. the code snippet there will error due to the missing bracket on the end.. I'm assuming then that form you have links to this script. Is it just the "amount" value not showing up on paypal?
-
Hmm, what does your form look like? are you getting the correct $_POST value? try echoing out $_POST['formtext1'] (assuming it's 'formtext1') and just make sure it does have a value..