Mahngiel
-
Posts
1,068 -
Joined
-
Last visited
Posts posted by Mahngiel
-
-
you can also force the browser to use a new version instead of the cache by appending a version to it.
style.css?v=habberdashery
-
take a look at the Media library i have in my signature. it'll make uploading a snap for you.
In regards to showing the last uploaded item:
after you insert into the database, run
$this->db->insert_id()
to get the table ID number for the image. you can use that to retrieve the image from the DB whenever you want to call it. -
such a strange question. to me, JS is black. no editor i've ever used (aside from gEdit) has a coloring template for javascript vars/tags/functions. so black... plain ol' black. and yes, @kevin, PHP is blue...
-
With all the users you may have and the various amount of surveys that are possible to exist, it's quite likely your mail server could get tagged as a spammer.
10 users with 10 different surveys to take = 100 emails.
Something to keep in mind.
-
I think the gears are turning now.
So it's all about the server request method that a form provices, whereas a URI request will always be a GET request as far as the webserver (not the framework) is concerned. Hence, the failed server status. Makes a lot of sense now that you point it out.
Thanks, Req. You're always spot on when I need it.
-
code used for screenshot:
echo shell_exec("curl -s 'http://forums.phpfreaks.com/index.php?topic=364198.0' | grep 'description' | awk -F 'content=\"' '{print $2}' | awk -F '\"' '{print $1}'");
-
@jazzman1, by "execute the scripts" i'm assuming you're asking if I've ever used what i described? The answer is of course, else I would not have posted it. I didn't test the command in PHP, but through CLI. So it might be broken - but the concept remains
-
Ok, I accept that. However, let's venture down this path so I can continue my need-based edumacations.
Since the routing (and general need for this issue) revolves around Laravel and it's routing, I'll be using that code. I'll also do my best to explain, since I don't expect anybody to research Laravel's docs to follow along.
Goal: Delete a database entry
Here's the route. the static Route method can be one of the four request methods. From there, it's the URI path and some other info, such as which controller/method to use.
Route::delete('admin/module.uninstall', array( 'uses'=>'modules@uninstall'));
The controller method is named in a matching convention to the request method:
public function delete_uninstall()
Now, using a form to submit data to the method works just fine. Problem is, now i have a form button
So, instead of having a lame-duck form button (and potentially 30+ of them), i tried to use a regular html link.
<a href="admin/module.uninstall.module_slug">Uninstall</a>
And the route becomes
Route::delete('admin/module.uninstall.(:any)', array( 'uses'=>'modules@uninstall'));
Controller
delete_uninstall( $slug )
This, however, causes Laravel to shit bricks. Converting the request method to GET for router / method produces desired effect. But, as I'm learning something new I would like to get as best of an understanding as possible.
So the questions that remain:
[*] Should I maintain the DELETE routing with a form button because the class method is only used for deleting an entry - this is good semantics
[*] Is it possible to access this DELETE routing through any other method besides a form post
[*] Should I instead use a GET and act like it's all good?
-
Sure, provided you have a *nix based server. shell_exec
for reading websites
echo shell_exec(curl -s 'http://forums.phpfreaks.com/index.php?topic=364198.0' | grep 'description' | awk -F 'content="' '{print $2}' | awk -F '"' '{print $1}');
for reading files
echo shell_exec(grep 'description' /path/to/file | awk -F 'content="' '{print $2}' | awk -F '"' '{print $1}');
-
Must PUT and DELETE be done through a form or is it possible to communicate via other methods?
I ask because I've just begun playing with a framework that sets routing based on the request method and DELETE doesn't behave like i thought it did. (passing the information to the method via link)
-
why couldn't you just update your other thread on this topic?
-
Why rename the image at all? you should instead call the thumbnail directory when you want a thumb vs full size. It'll also save you from a query call or table overpopulation
assets/
>images/
>>thumbs/
>css/
>js/
define('IMAGES', '/path/to/assets/images/'); $image = 'cool_pic.png'; <img src= <?php echo IMAGES . $image;?> /> <img src= <?php echo IMAGES . 'thumbs/' . $image;?> />
-
If anyone has any pointers for me on these scenario's, please share them with me as currently it all goes through
$o->set($name, $value)
.My (limited) experience and reading says that's a much better plan than having individual getters/setters. Specialized setters/getters could always be drafted.
-
what you're doing will hurt you if you plan on having more than one poll.
-
get/set is newer to me as well, but I do believe having public variables is also a concern that they could be overwritten by children causing unwanted consequences down the line. this is why i believe it's best practice to have each child / caller use gets and sets since it applies to scope only.
-
well i'll be damned! i guess the fact of it being called 'middle part' on the php manual eluded any sort of google results. Cheers, thorpe!
-
I want a speedy ternary operator! I don't know if any other langs have this, but it would be super cool
$this->object->property['value'] ? $this->object->property['value'] : 'you suck';
becomes
$this->object->property['value'] ? &$$ : 'you suck';
the
&$$
(or any other way to reference the preceding value) simply becomes a reference to the value being conditionalized. For instances where two PHP variables are being compared, the first var is the one who gets perpetuated over.$somevar === $othervar ? &$$ : 'no match'
equates to
$somevar === $othervar ? $somevar : 'no match'
-
You can see i provided
set_value()
, right? -
@media
max-width
will only respond when the viewing area is less than it. if you want to only target devices and not desktops with your queries, you need to use*-device-width
-
oh i'm sure it does. but because you're in unfamiliar territory, you don't recognize it.
-
a) this is less about javascaript and more about php. you just need to write the responses out from your database.
b) starting at the "advanced" stage is not a recommended place for beginners
-
check your debug console for any errors... based on your code i can only imagine the file path is wrong.
-
why wouldn't it?
-
I am looking to modify functions in wordpress but in a way that protects my modified code from the inevitable upgrades that will be coming along.
I never bothered with WP, but it would seem strange to me that a) you can't just install hooks that modify the core without having to hack the core and b)that you cannot just disable automatic updates - it would seem crazy to me to disallow THAT
PHP captcha without graphics ?
in PHP Coding Help
Posted
There's the 'select the [random] image' where a few images are randomly picked from a database and order.