scootstah
Staff Alumni-
Posts
3,858 -
Joined
-
Last visited
-
Days Won
29
Everything posted by scootstah
-
A question regarding delete user session
scootstah replied to helloworld001's topic in PHP Coding Help
What are you hoping to achieve here? What you describe is how it is intended to work. -
Laravel is much more opinionated than something like Symfony2. It sacrifices some things in order to make it more simple to use. It's still a great choice, though, especially if you're still new to frameworks. Symfony2 is very powerful, but it also has a really steep learning curve.
-
Symfony2 does not force anything on you. With any framework there are certain "rules" to follow, and preferred ways of doing things, but that is for the better. Except for some sort-of strict structure conventions (which you can totally ignore if you want, in your own application), Symfony2 gives a lot of freedom to do what you want to do. Your framework seems to lack any kind of structure or architecture. You just kind of arbitrarily dumped everything into a few files in /common/. As someone who is complaining about other frameworks being too restrictive, you should take a look at what you have made - your framework is very tightly coupled to not only a specific database driver, but also to a specific database schema. Your classes hold way too much responsibility, and your structure is not consistent (some methods have visibility keywords, some don't. Some have docblocks, some don't. Etc). What you have here is more like an application and less like a framework. A framework should be reusable in a wide variety of applications with freedom of choice. You're not offering that here. I was once in the same boat as you - I started with CodeIgniter and then found it hard to use the other frameworks, because I thought they were weird after using CI. Well, it turns out that CI is the weird one. Forget everything you think you know about frameworks and just start fresh with a new one. I usually recommend Symfony2, just because of its popularity and the fact an increasing number of other projects are starting to utilize the Symfony components.
-
How to make a request to plop into a modal with AJAX
scootstah replied to Q695's topic in Javascript Help
Sure, I just left the href attribute out for the sake of example. -
Show me what I'm doing wrong with preg_replace_callback
scootstah replied to CrystalSeabolt's topic in PHP Coding Help
I think the error tells you pretty clearly what the problem is... Look at the error, then at your pattern. Look at the error, then at your pattern. Error...pattern... -
There is a built-in removeformat control to do that. http://www.tinymce.com/wiki.php/Controls
-
Really need help fixing deprecated preg_replace()
scootstah replied to CrystalSeabolt's topic in PHP Coding Help
Did you try checking the manual for that function? http://php.net/manual/en/function.preg-replace-callback.php -
You should have an ID primary key in your database table. When you print out the emails, use the ID as the value. Then when processing the form, you can use a WHERE IN() clause in your query to select the rows that match the checked checkboxes.
-
How to make a request to plop into a modal with AJAX
scootstah replied to Q695's topic in Javascript Help
You can try defining your function in the jQuery namespace. $(function(){ $.modalize = function(href, url_data){ alert(href + '?' + url_data); }; }); <a onclick="$.modalize('the-url', 'the-data');">Click Me</a>Be careful with that approach though, so that you don't pollute the global namespace. If you want to do this with a bunch of functions then create a single property to put all of your functions under. Like, $.yourProjectName.modalize, $.yourProjectName.someOtherFunction. -
As I just mentioned in another reply to you, do not use htmlspecialchars() and htmlentities() at the same time. Pick one or the other. Also, don't use them while inserting data, use them while displaying it.
-
You should be validating that the $to is a valid email address, and that it only contains emails that it should. You don't want a malicious user setting that to anything they want, otherwise they can use your server to send spam. Also, do not use htmlspecialchars() and htmlentities() at the same time.
-
That's why I said you are unlikely to find an out-of-the-box solution. You're probably going to have to create your own plugin, or hire someone to do that for you.
-
How to make a request to plop into a modal with AJAX
scootstah replied to Q695's topic in Javascript Help
You're trying to run your function before jQuery is initialized then. You'll either want to place your function inside of jQuery's $(function(){ }); block, or actually use jQuery as it was intended, like CroNiX has pointed out. The alert he used is just an example, you can put whatever you want inside there. -
WordPress is pretty much as customizable as it gets. You are unlikely to find an out-of-the-box solution that does exactly what you want. At some point you are probably going to need to write custom code.
-
ID's are unique, you can't use them on multiple elements on the same page. Classes can be reused though, so just give each textarea a "wysiwyg" class and use that for the selector. You haven't mentioned what you're using for a WSYIWYG, so that's about as much detail as I can give.
-
It's largely about preference and the goals of your project. If you're more familiar with PHP, go with PHP. If you're more familiar with .NET stuff, go with .NET stuff. As for PHP frameworks, I would drop Codeigniter and Yii from your list. Symfony2 and Zend are roughly equal, and they both have a pretty steep learning curve. Laravel is built on Symfony components, and because it's highly opinionated, it's a little easier to pick up. My loyalties lie with Symfony2, but you can't go wrong with any of the three. With that said, you may not need a full stack framework. Have you looked at some common CMS platforms such as Drupal?
-
Storing the email in a cookie is just a silly idea to begin with. What if they use a different browser, or a different device entirely to click the link in their email?
-
How to make a request to plop into a modal with AJAX
scootstah replied to Q695's topic in Javascript Help
Any Javascript errors? Is your run_modal() function actually executing? -
Your idea will work, but it requires that you create a file for every type of plant. The correct approach is to use a database to store your dynamic content, and then you just query the database entry corresponding to the querystring parameter.
-
Well, I liked it. As someone who has been on both sides of the coin, I think questions like this are stupid and a waste of time. The person who wrote the question is probably only looking for one specific answer, to a problem that has a multitude of different solutions. I don't think these types of questions allow you to express yourself and demonstrate your experience. It just shows that you are good at interviews.
-
Of course, and that's nothing new. It's just parsing text.
-
That was from .josh
-
That's either going to work for ingenuity, or not work for cheating.
-
What makes you think a bot cannot click a link in an email? That is child's play. Your client may be small, but WordPress isn't. If a bot has cracked a popular piece of software, which is what it sounds like, generally you can just implement some other extra custom method for stopping spam. That will probably eliminate a good deal of it, and then they would need a targeted attack.
-
I mean, if humans were smart enough to instantly know the absolute best way to write a program from start to finish, then they could probably skip refactoring. But only if the program never changes after they write it. Refactoring serves two purposes. The first is to improve/refine code once something is working. The other is to make changes to accommodate new features or a design change. Often, features that we aren't 100% sure how to implement, or don't how it will work with the rest of the system, take a bit of trial-and-error. So you maybe just make one class/method, and dump a bunch of code in to get a proof-of-concept. You don't want to spend a lot of time planning on this nice pretty system when you're not even sure if your idea will work. So, you just write some messy shit to get something working. Once you have something working, then you can take some time to remove repeating code, reduce method/class responsibility, abstract some things, decouple some things, etc. This is refactoring. If humans were smart enough to know the end result before they wrote it, then they wouldn't need to refactor. EDIT: Haha damn Giz, way to describe a nightmare scenario.