RichardRotterdam
Members-
Posts
1,509 -
Joined
-
Last visited
Everything posted by RichardRotterdam
-
I guess that would be a good example of when the serialize would come in handy so that's a good point. However if for example you want to change a user name, then simply sending the id and a new name would be enough instead of cramming a User object inside a session.
-
Just curious but what is it that the script is suppose to do. Instantiating a PHP object and storing it in a session doesn't really seem right. Couldn't you simply instantiate a new object in your ajax script?
-
Please advice me on a powerfull WYSIWYG editor
RichardRotterdam replied to redarrow's topic in Miscellaneous
The best way to see what best suits your needs is by simply trying these RTE/WYSIWYG editors out. There are tons of comparison charts out there, you could select a WYSIWYG editor on the criteria for what matters to you to most. -
[SOLVED] MVC + Smarty... best practices?
RichardRotterdam replied to alexweber15's topic in Frameworks
I personally don't like smarty much because I think it's syntax doesn't make anything better. You may want to look at the following thread that discusses smarty http://www.phpfreaks.com/forums/index.php/topic,266164.0.html However I do like how Zend_Layout handles things as it concentrate on the html output of a certain controller by building a view. I think cakePHP handles this very similar as ZF does (not sure though). Readup on how the views are handled in the different MVC frameworks available as you might want to get rid of smarty entirely. -
The onload event is correct right now so your problem lies elsewhere. More details are required in order to find out what it exactly is that goes wrong. Here are a couple of details that might help finding out what it is. 1. What does your show_images() function look like? 2. What does your source look like when you check it in the browser (no php) 3. Do you have firebug or some other js debugging tool for your browser if so do you receive any javascript error and what is the error? 4. What does the URL look like you request using Ajax (try an alert or console.log in firebug)?
-
That reminds me of a quote I read before: Sounds like fun I want to learn about it.
-
This is JS but Mainly a PHP Problem, Please help!
RichardRotterdam replied to Marsha's topic in PHP Coding Help
If your fetching multiple records from a db you could create an unique id for div element something like: <?php for($i=0; $i<sizeof($records); $i++ ): ?> <a onMouseOver="ShowPopup('hoverpopup<?php echo $i; ?>');" onMouseOut="HidePopup('hoverpopup<?php echo $i; ?>');">link</a> <div id="hoverpopup<?php echo $i; ?>"> <!-- popup stuff --> </div> <?php endfor; ?> -
Actually remove that code it's a old bad habbit of mine that I used since mootools 1.0 Hmmm that probably is the way to go still you'd be having a couple of draggable object, I don't think you will gain performance. With "this" do you mean inside the Drag class and for what would you like to use it? Out of curiosity are you going to get these items from a database? I remember trying to create something similar a long time ago. The thing I got stuck with was connecting the Item Id's from the database to these draggables somehow. If so maybe you got an idea how to do this.
-
Echo all results from PDO query
RichardRotterdam replied to lostprophetpunk's topic in PHP Coding Help
try fetchAll instead of fetch to return an array $obj = $stmt->fetchAll(); -
Let me clarify that with some code. In the following example I assign the options from the constructor to this.options instead of using this.setOptions() which is nearly the same var yourClass = new Class({ options:{ color: "#FFF" // start value for color }, initialize: function(options){ // assign options to this.options instead of the setOptions() method this.options = options; } } How ever in the above code you will lose the color value #FFF that's why setOptions is used instead. You also might want to check out what the manual says about setOptions http://www.mootools.net/docs/core/Class/Class.Extras#Options:setOptions What about passing an array with a single value inside it? I think that would solve it. Ofcource you could also write something in your constructor method which checks the data type passed var room = new Room({ items:[ new Item({ id:1, name:'banana' }) ] }); // or using new Array var room = new Room({ items:new Array( new Item({ id:1, name:'banana' }) ) }); I'd use a Item object over simple strings btw. Your Item objects will be drag-able so you probably want to build in some methods for the Item objects later on. That was a mistake it should have been commented only once. Hope it all made sense though
-
If you're going to do this the mootools way have a look at a class template by one of the mootools developers http://davidwalsh.name/mootools-12-class-template I think the logic behind this would be to have a method for the Item objects that checks in what room it is once it is dropped inside a room. As find this topic kinda interesting I made a small start with your classes. // the room class var Room = new Class({ //implements //implements Implements: [Options], //options options: { id: '', name: '', items:[] }, //initialization initialize: function(options) { //set options this.setOptions(options); //set the option attributes as internal vars this.id = this.options.id; this.name = this.options.name; this.items = this.options.items; }, // place an item in the room setItem: function(item){ // put the item in the internal array this.items.push(item); }, // get an item by id getItem: function(id){ return this.items[id]; }, //get all items inside the room getItems: function() { return this.items; } }); // the item class var Item = new Class({ //implements Implements: [Options], //options options: { id: '', name: '' }, //initialization initialize: function(options) { //set options this.setOptions(options); //set the option attributes as internal vars this.id = this.options.id; this.name = this.options.name; }, }); // instantiate new room var room = new Room({ id:1, name:"darkroom" }); // instantiate new item var item1 = new Item({ id:1, name:'banana' }); // instantiate new item var item2 = new Item({ id:2, name:'katana' }); room.setItem(item1); room.setItem(item2); console.log(room.getItems());
-
What does you ajax_showTooltip function look like?
-
Ajax-Form submission, safe from SPAMS ?
RichardRotterdam replied to avvllvva's topic in PHP Coding Help
Direct url entry could be one of the options. Pretty much you can apply the same spam prevention techniques as non ajax forms. -
Ajax-Form submission, safe from SPAMS ?
RichardRotterdam replied to avvllvva's topic in PHP Coding Help
What I see on that page is a CAPTCHA -
Ajax-Form submission, safe from SPAMS ?
RichardRotterdam replied to avvllvva's topic in PHP Coding Help
The chance that you will receive spam is just as big with an Ajax form as it would be with a non Ajax form. Someone could easily find the location of the script that processes the Ajax form by looking at your HTML source. edit I'm sorry but I fail to see how setting a session on a onclick event will prevent spamming. I could easily write a script that sets that session and spam the hell out of you anyway. -
[SOLVED] need help parsing xml document please...
RichardRotterdam replied to meomike2000's topic in Javascript Help
It looks like half baked PHP and XML is that really the XML you want to parse? And do you want to do this using Ajax? -
Two responses from the same ajax function
RichardRotterdam replied to habib009pk's topic in Javascript Help
Wat you are requesting is probably possible, you're question is vague though. Why don't you make a start yourself so people can help you with that? The community members are not here to write code for you -
[SOLVED] Store serialized data or create a separate table?
RichardRotterdam replied to gamex's topic in MySQL Help
I think your table names are a bit confusing but maybe that's just my opinion This is what I think you mean. You want to know if you should use the following tables: - Oders (which you name order_header) - Products (which you name order_details) - Product_attributes (which you name item attributes If a product/item can have a x number and type of attributes I would create the 3rd table. Cramming a formated string in one table field which you can later translate into an array is just a bad database design (even though both OSCommerce and Virtuemart do this). -
For a simple div overlays google up "javascript modal box" and "javascript dialog box". Most javascript frameworks solve the crossbrowser issues so you might want to use one that's written for a js framework. Facebook seems more complicated with the js GUI interfaces though. You might want to look at extJs or Mocha for mootools.
-
This is the first result I get using Google http://www.w3schools.com/PHP/php_db_odbc.asp Doesn't that one work?
-
Java != JavaScript Is there any reason you're using Javascript? Why not simply do it all with PHP if I may ask? And what does your comment box look like in HTML?
-
Is this one of the lines that produces the error? if (preg_match ('/^[A-Z \'.-]{2,20}$/i', $trimmed['conductivitybars'])) { Here you are probably requesting a value from the array where the index 'conductivitybars' doesn't exist. in code. you need to set the index before you can use it. for example this will not give a notice message: $trimmed = array(); $trimmed['conductivitybars'] = ""; echo $trimmed['conductivitybars']; this will give the notice message: $trimmed = array(); // without the 'conductivitybars' index set echo $trimmed['conductivitybars'];
-
[SOLVED] PHP shopping cart that uses arrays?
RichardRotterdam replied to TheJoey's topic in PHP Coding Help
A shoppingcart that uses arrays instead of a database doesn't even exist. -
Did you mean this thread posted a few hours ago didn't receive any responses? http://www.phpfreaks.com/forums/index.php/topic,268254.0.html Hmmm
-
Question about what type of JavaScript is being used?
RichardRotterdam replied to kratsg's topic in Javascript Help
If you look at the source for those really annoying div overly popups you'll often see a function nearly identical to what you have written. It does indeed work. However if you look at the uncompressed mootools or jQuery source you'll see a lot more magic going on for the selector method.