and I want to use change_tag with these functions
where??
and I want to use change_tag with these functions
where??
I want to use it on all tags inserted into the database.
$tag=change_tag($tag);
should be sufficient
dagon;10967791 wrote:
$tag=change_tag($tag);
should be sufficient
Hey dagon,
Thanks for the reply.
I thought it would be as you stated. I had placed
$tag=change_tag($tag);
before my post ... in the controller which is working with all my other functions but I didn't get the ucfirst to work. I placed it above and below the copy($_FILES .....
which made scene to me since I am calling other functions there which place photo data into the DB.
I also placed it at the beginning of the other two functions. So I thought I'd ask for some assistance.
Right now all my functions are in db_fns.php which is an include at the top of index.php and index.php is my controller at the moment.
need to see the code your using.
dagon;10967846 wrote:need to see the code your using.
Thanks Dagon
What additional code would you need to see other than the functions and switch I posted in my 1st post?
If I'm understanding the question correctly, all you should need to do is run the function being called through your change_tag() function, e.g.:
$result = change_tag(your_function($function, $params));
NogDog;10968153 wrote:If I'm understanding the question correctly, all you should need to do is run the function being called through your change_tag() function, e.g.:
$result = change_tag(your_function($function, $params));
Hey NogDog
Thanks
Using
$tag = change_tag($tag);
at the beginning
foreach($tags as $tag)
{
$tag = change_tag($tag);
works
Yet I'd like to use an ucfirst function in my controller switch rather than inserting it in to each function that has string input posted.
Afraid I'm not seeing what the question/issue is.
Once the function has been defined, you should be able to use it anywhere you want in your code. Or, I'm completely misunderstanding what you are asking?
you could use array_walk in the case 'section' to apply it to $_POST['photo'], but there's no real benefit
dagon;10968250 wrote:you could use array_walk in the case 'section' to apply it to $_POST['photo'], but there's no real benefit
Thanks
I read http://php.net/manual/en/function.array-walk.php
If you have time would you post how I'd write and use that code?
as I said ... I am unclear how to apply one function to another here.
using
foreach($tags as $tag)
{
$tag = change_tag($tag);
will only upper case my first tag in the array.
array_walk may upper case each tag word.
emetib;10968268 wrote:using
foreach($tags as $tag) { $tag = change_tag($tag);
will only upper case my first tag in the array.
no it applies it to each $tag
Seems like some sort of question of scope. If all your functions are in an external file, I'd try to validate that the external file will parse correctly. This is easily done if you have command line PHP ability:
$ php -l db_fns.php
No syntax errors in db_fns.php
You might also try wrapping your code in a conditional test that uses [man]function_exists[/man] with an appropriate error handler:
<?php
if (!function_exists("change_tags")) {
die("Change tags isn't a valid function here at line #"); // put your line # in there
} else {
// do your processing
}