Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
Cannikinn #1
Any way to get the name of the function you're currentlyin?
Let's say I'm making a CFC with several <cffunctions> inside. Is there any
way, from inside of the function, to retrieve the name of the function I'm
currently executing?
What I've got is a CFC that will always include a CFM file that's the same
name as the function. For example if I'm calling the "jump" function, I'm
going include a file called "jump.cfm". Rather than pass in the name of the
function each time, I'd rather just have each function be able to include the
appropriate file on its own.
Cannikinn Guest
-
[PHP-DEV] named function arguments (was: Proposal: Dangling comma in function
Christian Schneider wrote: Named parameters - i think is very good idea. I know i would use them. I'm really not sure about the correct... -
#25866 [Bgs]: Using error_reporting() function don't change output of phpinfo() function
ID: 25866 Updated by: sniper@php.net Reported By: sfournier at dmsolutions dot ca Status: Bogus Bug Type: ... -
note 33714 added to function.register-tick-function
please can anyone help me to discover if this function can be used to make a chat ---- Manual Page --... -
note 33575 added to function.register-shutdown-function
If your script exceeds the maximum execution time, and terminates thusly: Fatal error: Maximum execution time of 20 seconds exceeded in - on line... -
note 33132 deleted from function.register-shutdown-function by sniper
Note Submitter: markus@malkusch.de ---- I can't agree with nick at nickjoyce dot com. I use php 4.2.3 on linux and my shutdown function is... -
boughtonp #2
Re: Name of current function
I don't think there is, though it seems a bit of an odd situation anyway.
Are you sure including a CFM is the best way to achieve whatever it is you're trying to achieve?
boughtonp Guest
-
Cannikinn #3
Re: Name of current function
I sort of got it working, but without the function name. I basically save the
name of the function I'm calling in a THIS. variable and then use that whenever
I need the name.
I don't know if you're familiar with Ruby on Rails, but I'm applying the same
document structure and methodology to ColdFusion. I have a controller and then
several views. For each page of my application, there is a method in the
controller with the same name, as well as an associated view (thus why I wanted
the name of the function, because that's also the name of the view to include).
So when I browse to a page, I'm actually calling the method in the CFC, which
then uses a <cfinclude> to show the view.
I'd actually rather use <cfimport> and custom tags, but when you call one via
<view:index> any variables you created in the controller aren't available to
the tag, you have to pass them in manually. <cfinclude> automatically has
access to everything. Right now it's the closest to Rails functionality that I
could get. I've only been working on it for 1 day so far, but it's looking
good!
Cannikinn Guest



Reply With Quote

