PHP variable scope bug in CT
I have a page where I declare PHP variables which are then
used inside an include file.
When I try to edit the page in Contribute, I get a notice of
"Variable undefined" in the include.
This do work in Dreamweaver and it did work in Contribute in
other projetcs I have done.
Any suggestions?
Hi Dont know if your still getting notifications on this but...
Did you ever find an answer as I am having the same issue.
I have tracked down why its not working but don't know how to stop it.
In Dreamweaver it keeps the php include reference as code when it saves the file, where as Contribute seems to process the include and dump the output back to the page.
This means that any common includes like headers and footers are no-longer included dynamically when the page loads as Contribute has embeded them when it created the page.
This alsos mean if you have included a php file with common functions that you may use on your site this will never appear and any variables you declare wont exist.
How rubbish is that!?
If anyone can help with this issue it will be greatly appreciated.
I'm hoping there is some simple Contribute comment I can put in to say "dont process this code - leave it alone!"
Thanks
Similar Messages
-
Having Truble Reading and Echoing Using PHP in HTML. Possible Variable Scope Problem?
Hey guys,
Thanks for your always knowledgable help! Today I am working with displaying text from a text file in an HTML table using PHP. I can't get the data to display properly, I think it has something to do with the scope of the variables, but I am not sure. Here is the code I am struggeling with:
<table width="357" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="165">Pizza 1</td>
<td width="186"><? echo $price['0']; ?></td>
</tr>
<tr>
<td>Burger 1</td>
<td><? echo $price['1']; ?></td>
</tr>
<tr>
<td>Drink 1</td>
<td><? echo $price['2']; ?></td>
</tr>
</table>
In the above PHP (not shown) the array $price is filled properly (I tested by echoing each bit line by line) but by the time we get into the HTML it seems the array is empty or it is not liking how I am calling it. Does the scope of a PHP variable end with the closing "?>" tag? Am I missing something? Bellow is the full code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body {
background-color: #333;
color: #FFF;
</style>
</head>
<body>
<?php
$menu=fopen("prices.txt","r") or exit("Unable to open file!");
$price=array();
$priceposition=null;
$tempstring;
//This loop does all of the READING and populating of variables
while(!feof($menu))
//Check to see if this is the first pass, if not add one to the array possition
if ($priceposition==null){
$priceposition=0;
else{
$priceposition++;
//populate the temparary string
$tempstring = fgets($menu);
//Populate the array if the temporary string is not a comment
if(substr($tempstring,0,2) != "//"){
$price['$priceposition']= $tempstring;
echo $price['$priceposition'];
//End of reading loop
fclose($menu);
?>
<table width="357" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="165">Pizza 1</td>
<td width="186"><? echo $price['0']; ?></td>
</tr>
<tr>
<td>Burger 1</td>
<td><? echo $price['1']; ?></td>
</tr>
<tr>
<td>Drink 1</td>
<td><? echo $price['2']; ?></td>
</tr>
</table>
</body>
</html>
and you can run the code on my test server here: christianstest.info/phptest/readwritetesting/readtest.php
thanks guys!MurraySummers wrote:
Try changing this -
fclose($menu);
to this -
fclose($menu);
echo "<pre>";exit(print_r($price));
and see what you get.
Wow, what a great little peice of testing code, thanks! That showed me the problem right away! Is there any way to test your php line by line in Dreamweaver CS6? I am used to computer programing in Visual Studio and Eclipse where they have an option of running code line by line and seing how variables populate and change with each line of code execution. Or is thier a program that can do this for PHP? -
Search/Replace for/with php variable name
Hi all.
I have just updated from Dreamweaver 5 to 5.5 and now I am missing a very handy functionality.
What I want to do is to replace all occurences of $a with $b.
In Dreamweaver 5 that was very easy by using "Find and replace":
Find in: All open documents
Search: Sourcecode
Find: $a
Replace: $b
Active options: Match case and Match whole word !!!!
Now in Dreamweaver 5.5 the option "Match whole word" is automatically disabled as soon as I enter a $ (dollar) in the search field.
I assume this has something to do with regular expressions but I do NOT check the option "Regular expression" in the search and replace dialog.
Is this a bug?
What are my options now.
If I don't have the possibility to to tick "Match whole word" my search does also replace all occurrences of $abc and $answer etc. with $b.
Thank you for your helpsamet2011 wrote:
I have Dreamweaver 5 and 5.5 running parallel on my computer.
I can confirm that the way I described and used to use is working on Dreamweaver 5.
I was the person who informed Murray that Dreamweaver CS5 and CS5.5 both behave the same way. I have just checked as far back as CS3, and it also disables "Match whole word" when you enter a dollar sign in the Find field of the Find and Replace dialog box. In fact, that option is disabled whenever you enter any nonalphanumeric character (except an underscore) in that field. It's not limited to dollar signs.
Why it's not disabled in your version of CS5 is a mystery.
However, to solve your problem, you don't need either a regex or "Match whole word". Simply type the name of your PHP variable followed by a space into the Find field. Also add a space after the name of the variable you're using as the replacement.
What "Match whole word" does under the hood is to use a regular expression to find a word break. As long as you leave a space between your variables and any following code, simply adding the space to your search will do the trick.
However, if you have cases where a variable is followed by a comma, closing parenthesis, or some other character, you will need to use the following regex:
Find: \$variable_name\b
Replace: $new_name
The \$ looks for a dollar sign. The variable_name matches the literal text of the variable name (replace it with the actual text you're looking for). The \b matches a word break in exactly the same way as "Match whole word".
In the Replace field, $new_name is the literal name of the new variable. -
I have a lot of included files in my site. At the end of each
included file,
I close the sql, but would also like to close the variables
used to produce
the HTML.
I'm having a hard time with my searching getting some
relevant results. Can
somebody help me here on what I"m looking for?
TIA,
Jon Parkhurst
PriivaWeb
http://priiva.net.On Thu 24 Aug 2006 04:36:46p, crash wrote in
macromedia.dreamweaver.appdev:
> I have a lot of included files in my site. At the end of
each included
> file, I close the sql, but would also like to close the
variables used
> to produce the HTML.
>
> I'm having a hard time with my searching getting some
relevant
> results. Can somebody help me here on what I"m looking
for?
I'm not sure I follow you here. Are you saying that you want
to limit
the scope of the PHP variables to the included file, so that
in something
like this:
<?php
include_once('fileA.inc');
include_once('fileB.inc');
include_once('fileC.inc');
?>
you can have a variable, say $crashsVariable, in fileA.inc,
fileB.inc and
fileC.inc, and have it take on a separate value in each of
them, but not
affect any of the others?
Without doing any experimentation... Using the
include_once()s makes the
include files, and thus all their code, part of the larger
code block.
AFAIK, the scope of a variable would be the calling file, so
the answer
would be no.
The PHP docs[1] have this to say:
The scope of a variable is the context within which it is
defined.
For the most part all PHP variables only have a single
scope. This
single scope spans included and required files as well.
but go on to add:
However, within user-defined functions a local function
scope is
introduced. Any variable used inside a function is by
default limited
to the local function scope.
So if you use $crashsVariable within a function within the
included file
(or, for that matter, the main file), it's local in scope.
Otherwise, a
variable exists for the entire page.
If you've spent the include file building a long string of
text, which is
eventually output as HTML:
<?php
$myvar = "<head>\n";
$myvar .= "<title>$myDynamicTitle</title>\n";
echo $myvar;
?>
the only way I know would be to do something like
$myvar = '';
Hopefully David Powers or somebody who actually knows might
check in.
[1]
http://www.php.net/variables.scope -
Variable Scope at package or interface level
Hi,
Can we set the ODI Project variable scope to package or interface level
because in my project im using a last rundate refresh variable this variable value will be changed at the time of execution of each package.
Thanxs
Madhaviyou can create it as "Not Persistent" and then its value exist per ODI session.
In this way, several sessions can keep independent value to the same variable. -
Autocomplete Declared PHP Variables in Dreamweaver
Is there a way to autocomplete php variables that have been
declared? For instance, whenever you type $ in a PHP code block, a
pop up list would automatically come up with all the variables you
have already declared. This would GREATLY speed up coding and help
to insure coding accuracy.
If there is a way to do this now, could someone please clue
me in? I've searched and searched forums, help files, and google.
If this is not available, where should I go to request this
feature?
Shannajsteinmann wrote:
> With asp.net missing, along with several other things
discontinued, dreamweaver will have to cater to php developers in
these kinds of ways.
If you want Dreamweaver to add features posting this sort of
comment in
a user-to-user forum won't have the slightest impact on the
direction
that Dreamweaver actually takes. You need to make your views
known by
submitting feature requests through the official channel:
http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
Submitting requests doesn't guarantee that your ideas will be
adopted in
the next version or even the one after that, but it does get
them on the
development team's radar.
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
I am looking for a solution to a problem I am having with an
XSL stylesheet and trying to use a php variable. The page I am
working on is a page to display some information based on the
graduation year of a class (I work at a school). For example last
years graduating class of 2006.
I have a statement in the XSL sheet that limits the shown
data to only that class year
<xsl:for-each
select="school[class_of='2006']">
I would like to replace that 2006 above with a php statment
such as $classyear since on that page the data is to display the
variable is already present, but I cannot get it to work. I have
tried to place php in the XSL and also to change the extention etc
and they all produce errors. I am assuming that XSL just can't use
variables in it?
Any help would be greatly appreciated. I would hate to have
to duplicate that one XSL sheet for every class year.
thanks
chrisDavid,
thank you so much so far for you help, it does sounds like we
are talking about the same thing. I think I am getting close.
I do want to pass the value when the XSL sheet is embedded.
I tried that and it seemed to not work, says the variable is
not found (I am using the dreamweaver built in transform).
I am just getting into the more complex XML stuff so I
apologize for my lack of knowledege.
I have pasted some of the code below, any idea what I am
doing wrong?
the page where it is embedded is
http://www.nmhschool.org/news/test11.php
php doc with the embed and include
<?php
$mm_xsl = new MM_XSLTransform();
$mm_xsl->setXML("test11.xml");
$mm_xsl->setXSL("test11.xsl");
$mm_xsl->addParameter("yearXX", "2006");
echo $mm_xsl->Transform();
?>
http://www.nmhschool.org/news/test11.xsl
is the XSL
<xsl:for-each
select="Report/GroupHeader2/GroupHeader2_1[q1.CnPrAl_Class_of =
$yearXX]">
<table width="100%" border="1" cellspacing="1"
cellpadding="1">
<tr> blah blah blah........
http://www.nmhschool.org/news/test11.xml
is the XML data -
Okay so I have a php variable, and I set it to "Home", then when I call it though I get a result of "home". How do I make the variable retain the capital H?
MurraySummers wrote:
No - actually we were both incorrect. The only condition is "isset($_GET['page']", and if true, the first option is executed and a lower-case value is returned; if false, the second.
I think that's wrong. If the first condition was being executed then the OP would have the result "Home" returned NOT "home"
He/She has obvioulsy got a link set up like .php?$foo=Home
As the first condition IS met as you say and is correct the second condition is executed (met) as I say, the third is only returned if 1 and 2 are not met.
Oh ok I see what your saying. Cross wires AGAIN we both agree that the ?> is being met
I think half this stuff is a battle with the correct terminology aint it lol
So this is being met:
$page = (isset($_GET['page'])
This is being return as the above is met
? strtolower($_GET['page'])
This never gets a look in
: 'Home');
If you view the conditions as ? strtolower($_GET['page']) : 'Home');
Then youre right I'm wrong.
This is not a condition which I was taking into consideration.
$page = (isset($_GET['page']) -
Accessing PHP variables (especially _SESSION)
Hi,
since CaioToOn! suggested here that I should use $_SESSION and I need to do this anyway, I spent the last 1+ hours trying to figure out how to do that. Sadly, I could not really figure it out except that there seems to be an issue with the session ID and that it has to be passed along to the swf file.
Can somebody please tell me how to read/write from/to PHP variables (not $_GET)?
P.S.: Here a simple example code (test.php and then the testintro.fla AS code):
<? session_start();
$_SESSION["intro"] = 0; // has the intro been played?
... // code for including the swf
?>
if(intro == 0)
myclip.gotoAndPlay(2); // play intro
intro = 1;
else
{ myclip.gotoAndPlay(24); } // skip the intro and go straight to the endnone of those reasons would require php to embed a swf.
normally, with flash, you could use a session variable to pass data from html to the swf. you set your session variable's data with a html form or something similar and then use flashvars to pass that info to your embedded swf(s).
you can also pass html data to an embedded swf using javascript and the externalinterface class. -
Is there a PHP variable that will fetch the TITLE of the file?
I learned (thanks to David Powers) that you can use $_SERVER['PHP_SELF'] to refer to your current URL, which is useful in situations like putting a "Share on Facebook" button on your page.
However, some of these social networking sites allow you to also put the Article Title in the same button, so I was wondering if there was a PHP variable I can use for *that*. This way, by specifying the title of the article in the aptly-named title tag of the page, I can put those "submit this page to" links as includes that don't need to be specifically-edited for each page.Create a variable for the title and use it in both places.
<?php
$title = 'Things you always wanted to know about...';
?>
<title><?php echo $title; ?></title>
// later on
<?php echo $title; ?>
Alternatively, if your page content is generated dynamically, you can store the title in the database.
Another technique would be to base the title on the page name.
$page = basename($_SERVER['SCRIPT_FILENAME'], '.php');
$title = ucwords(str_replace('_', ' ', $page));
That would store "About Us" in $title if the page is called about_us.php. -
Javascript discussion: Variable scopes and functions
Hi,
I'm wondering how people proceed regarding variable scope, and calling
functions and things. For instance, it's finally sunk in that almost
always a variable should be declared with var to keep it local.
But along similar lines, how should one deal with functions? That is,
should every function be completely self contained -- i.e. must any
variables outside the scope of the function be passed to the function,
and the function may not alter any variables but those that are local to
it? Or is that not necessary to be so strict?
Functions also seem to be limited in that they can only return a single
variable. But what if I want to create a function that alters a bunch of
variables?
So I guess that's two questions:
(1) Should all functions be self-contained?
(2) What if the function needs to return a whole bunch of variables?
Thanks,
ArielAriel:
(Incidentally, I couldn't find any way of marking answers correct when I visited the web forums a few days ago, so I gave up.)
It's there...as long as you're logged in at least, and are the poster of the thread.
What I want is to write code that I can easily come back to a few months later
and make changes/add features -- so it's only me that sees the code, but
after long intervals it can almost be as though someone else has written
it! So I was wondering if I would be doing myself a favour by being more
strict about make functions independent etc. Also, I was noticing that
in the sample scripts that accompany InDesign (written by Olav Kvern?)
the functions seem always to require all variables to be passed to it.
Where it is not impractical to do so, you should make functions independent and reusable. But there are plenty of cases where it is impractical, or at least very annoying to do so.
The sample scripts for InDesign are written to be in parallel between three different languages, and have a certain lowest-common-denominator effect. They also make use of some practices I would consider Not Very Good. I would not recommend them as an example for how to learn to write a large Javascript project.
I'm not 100% sure what you mean by persistent session. Most of my
scripts are run once and then quit. However, some do create a modeless
dialog (ie where you can interface with the UI while running it), which
is the only time I need to use #targetengine.
Any script that specifies a #targetengine other than "main" is in a persistent session. It means that variables (and functions) will persist from script invokation to invokation. If you have two scripts that run in #targetengine session, for instance, because of their user interfaces, they can have conficting global variables. (Some people will suggest you should give each script its own #targetengine. I am not convinced this is a good idea, but my reasons against it are mostly speculation about performance and memory issues, which are things I will later tell you to not worry about.)
But I think you've answered one of my questions when you say that the
thing to avoid is the "v1" scope. Although I don't really see what the
problem is in the context of InDesign scripting (unless someone else is
going to using your script as function in one of theirs). Probably in
Web design it's more of an issue, because a web page could be running
several scripts at the same time?
It's more of an issue in web browsers, certainly (which I have ~no experience writing complex Javascript for, by the way), but it matters in ID, too. See above. It also complicates code reuse across projects.
Regarding functions altering variables: for example, I have a catalog
script. myMasterPage is a variable that keeps track of which masterpage
is being used. A function addPage() will add a page, but will need to
update myMasterPage because many other functions in the script refer to
that. However, addPage() also needs to update the total page count
variable, the database-line-number-index-variable and several others,
which are all used in most other functions. It seems laborious and
unnecessary to pass them all to each function, then have the function
alter them and return an array that would then need to be deciphered and
applied back to the main variables. So in such a case I let the function
alter these "global" (though not v1) variables. You're saying that's okay.
Yes, that is OK. It's not a good idea to call that scope "global," though, since you'll promote confusion. You could call it...outer function scope, maybe? Not sure; that assumes addPage() is nested within some other function whose scope is containing myMasterPage.
It is definitely true that you should not individually pass them to the function and return them as an array and reassign them to the outer function's variables.
I think it is OK for addPage() to change them, yes.
Another approach would be something like:
(function() {
var MPstate = {
totalPages: 0,
dbline: -1
function addPage(state) {
state.totalPages++;
state.dbline=0;
return state;
MPstate = addPage(MPstate);
I don't think this is a particularly good approach, though. It is clunky and also doesn't permit an easy way for addPage() to return success or failure.
Of course it could instead do something like:
return { success: true, state: state };
var returnVal = addPage(MPstate);
if (returnVal.success) { MPstate = returnVal.state; }
but that's not very comforting either. Letting addPage() access it's parent functions variables works much much better, as you surmised.
However, the down-side is that intuitively I feel this makes the script
more "messy" -- less legible and professional. (On the other hand, I
recall reading that passing a lot of variables to functions comes with a
performance penalty.)
I think that as long as you sufficiently clearly comment your code it is fine.
Remember this sort of thing is part-and-parcel for a language that has classes and method functions inside those classes (e.g. Java, Python, ActionScript3, C++, etc.). It's totally reasonable for a class to define a bunch of variables that are scoped to that class and then implement a bunch of methods to modify those class variables. You should not sweat it.
Passing lots of variables to functions does not incur any meaningful performance penalty at the level you should be worrying about. Premature optimization is almost always a bad idea. On the other hand, you should avoid doing so for a different reason -- it is hard to read and confusing to remember when the number of arguments to something is more than three or so. For instance, compare:
addPage("iv", 3, "The rain in spain", 4, loremIpsumText);
addPage({ name: "iv", insertAfter: 3, headingText: "The rain in spain",
numberColumns: 4, bodyText: loremIpsumText});
The latter is more verbose, but immensely more readable. And the order of parameters no longer matters.
You should, in general, use Objects in this way when the number of parameters exceeds about three.
I knew a function could return an array. I'll have to read up on it
returing an object. (I mean, I guess I intuitively knew that too -- I'm
sure I've had functions return textFrames or what-have-you),
Remember that in Javascript, when we say Object we mean something like an associative array or dictionary in other languages. An arbitrary set of name/value pairs. This is confusing because it also means other kinds of objects, like DOM objects (textFrames, etc.), which are technically Javascript Objects too, because everything inherits from Object.prototype. But...that's not what I mean.
So yes, read up on Objects. They are incredibly handy. -
Cfm template updating cfc variable scope
Don't know if anybody's run into this before, but I ran into a strange issue with the variable scope in a cfc. Basically, I have some application settings stored in a database table, and then I have a cfc saved to application scope in which I store the contents of the table in a variable scope query. Within the cfc, I have a getter function that preforms a query of queries to pull the data I need. I then have an admin screen within the application to update the settings.
This is (very generally) what my cfc looks like:
<cfcomponent name="settings.cfc">
<cffunction name="init" returntype="settings">
<cfset setAppSettings() />
<cfreturn this />
</cffunction>
<cffunction name="setAppSettings">
<cfquery name="variables.qrySettings" datasource="#application.dsn#">
SELECT *
FROM SETTINGS
</cfquery>
</cffunction>
<cffunction name="getAppSettings" returntype="query">
<cfargument name="id" />
<cfset var local = structNew() />
<cfquery name="local.qryResult" dbtype="query">
SELECT *
FROM variables.qrySettings
WHERE ID = <cfqueryparam value="#arguments.id#" cfsqltype="cf_sql_numeric" />
</cfquery>
<cfreturn local.qryResult />
</cffunction>
</cfcomponent>
In onApplicationStart in Application.cfc, I have this line:
<cfset
application.objSettings = createObject("component","settings").init() />Sorry, accidentally posted before I was done...
Basically, the problem is that I have an admin screen that updates the settings. I call the getter function in a cfm template, and I save the result to a variable called variables.qrySettings (same name as in the cfc) like this - <cfset variables.qrySettings = application.objSettings.getAppSettings(url.id) />. For some reason, this seems to overwrite variables.qrySettings in the cfc. Any ideas???? -
Variable scope with loaded external SWF's?
I’ve got an SWF, call it calcLite, that will be deployed both independently (ie: attached to an HTML doc) and also imported at run time (linked as an external asset via the loader class) to another SWF, let’s call it calcPro. That part is working fine.
I’ve got a global variable, gRunMode:String that calcLite must declare and set when it’s running independently, but must inherit when attached to calcPro (which will declare and set gRunMode before attaching calcLite).
Here’s where I am:
At the root of calcPro:
var gRunMode:String = “touchScreen”;
At the root of calcLite:
var gRunMode:String = “web”
if (this.parent == this.stage) {
gRunMode = MovieClip(this.parent.parent.parent).gRunMode;
I’ve also tried creating function in the parent to return gRunMode:
At the root of calcPro:
var gRunMode:String = “touchScreen”;
function getRunMode():String {
return gRunMode;
At the root of calcLite:
var gRunMode:String = “web”
if (this.parent == this.stage) {
gRunMode = MovieClip(this.parent.parent.parent). getRunMode();
I’ve also tried the second technique, renaming the global in calcPro to gRunModeExe incase there was a naming violation. In all cases I get “attempt to access prop of a null” error. The construct MovieClip(this.parent.parent.parent).function() works, I use it later in the program for a different function and it’s fine, just doesn’t work here.My bad, I wrote the post from memory at home. My actual code properly tested the stage (!=) and would have worked EXCEPT under the following condition:
This is my second project in a row that involved an SWF that must operate independently and also function as a loaded child to a bigger project. What I keep forgetting is that loaded content begins to execute IMMEDIATELY!!!, it does not wait to be attached to the stage. Further, loaded content does not have access to stage assets until it’s been attached, so any premature attempts to access global variables and functions from loaded clip to stage fail. A good explanation of these issues can be found here (scroll to middle of page, post by senocular titled Access to stage and root): http://www.kirupa.com/forum/showthread.php?p=1955201
The solution was simple enough. If calcLite is running as a child, stop in frame 1 (before any other processing) and wait for calcPro to push us to the next frame (which happens after attachment to the stage). If calcLite is running independently skip the stop and proceed as normal.
As for this.parent.parent.parent vs. this.parent.parent vs this.parent, since gRunMode is global within the calcPro scope any of these would probably work (although I’ve only tested the first option). The first parent references the loader object, the second parent references the movie clip to which the loader object is attached, and the third parent finally references root. -
I've got my app prototyped quickly with the default settings in Flex Builder 4. Now I'm going back and adding/modifying features to polish the app off.
For this application I'm using PHP5 as the server side.
The data paging is really cool and simple to call using the default settings. However, I'm running into issues with customizing the data paging feature.
This is the default header of the php function that was created for me:
public function getTblbrowserrecord_paged($startIndex, $numItems){...}
Instead of dumping all data back to the function I want to be able to search on certain fields so I created a new function called:
getTblbrowserrecord_search_paged ($szName, $szIP, $szRule, $szURL, $szDateLow, $szDateHigh, $szCode, $startIndex, $numItems ) {...}
The new function is tested and operates as designed.
I set the input types of the variables and return type (Tblbrowserrecord[]) of the new function then went to enable data paging. The first screen came up and asked me for the key to use which I selected. The next screen came up and asked me for the number of records which I set to 100 then went to select the count operation.
I initially selected the automatically created count() function but it came up with the error " Count operation parameters should match the paged operation parameters list."
So I created another function to match the search function's parameter's list:
public function count_searched($szName, $szIP, $szRule, $szURL, $szDateLow, $szDateHigh, $szCode, $startIndex, $numItems) {...}
But I still ge the error "Count operation parameters should match the paged operation parameters list."
But they DO match. I looked at the default functions that were created by FB4 and noticed that the automatically generated function count() has no parameters and the paged function has the two functions $startIndex and $numItems which are not identical yet they work. I tried removing those two fields from the count function but got the same results.
What am I doing wrong?
Thanks!Nevermind... For some reason my FB4 is not updating correctly. After removing the two control fields at the end of the list AND exiting the app/re-entering everything worked ok. I've been having this issue a lot lately and am thinking that is is a bug of some sort?
-
Why is variable scope so vexing?! Argh!
Dear Friends
I used to think that if I declared a variable at the top of
the first frame of my main timeline (and outside of any function
bodies) that it would basically be considered "global" and could be
accessed at any further frame in the main timeline (and by any
child of the main timeline via prefixing enough "parent."s) but
this is apparently not the case (unless there's something funny
with uints where their values go to 0 from one frame to the next.)
Is there something I'm missing here? Why is it so hard to declare a
variable that can be easily seen throughout the main timeline (and
the rest of the app as well)?
And speaking of children seeing their parent's variables,
what is the easiest way to make a variable declared on the main
timeline accessible inside of a child? I don't want to have to
count ancestors and add "parent.parent.parent." etc. and "root."
doesn't seem to work... What's the magic prefix? Isn't there also a
way of setting a variable equal to "this" on the main timeline? I
don't know how it works, really.
More generally speaking, does anyone have a surefire tutorial
on variable scoping? I've read Moock and pored over the Help manual
and it all still feels a lot less intuitive than it ought to. How
do I master this subject?!
Thanks and Be Well,
Grahamgraham - you're right in saying that a var on the main
timeline can be considered 'global' even without the use of a
'_global' keyword - and i remember in my early learning i
definitely thought the same thing as you are now. It's really a
matter of 'paths' as you mention, but one does need to 'point' to
the main in order to retrieve the value via root or a series of
parents - even when using class structures as is more common now
under 3, one still needs to point at the correct scope to access a
property.
sometimes though, a var can be 'reset' ... what i mean by
this is, say for instance you have declared a var on the first
frame, the playhead then navigates to a different frame wherein the
variable has been set to a different value, then at another time
the playhead returns to frame one (because one has a navigation
structure that does so) in this case the variable is 're-declared'
and set back to the default value! this type of situation often
occurs with a timeline based system.
class properties on the other hand, cannot be reset in this
manner, which is one of the many reasons why class based systems
are better for complex programming. personally, now-a-days my
programs so not usually contain anything on the main timeline, no
code or assets, instead all operations are achieved through code,
mainly within class files (as is the benefit of 3)
I'm sorry i don't know of any tuts i could point you to, just
stick with it - i think that over time it hierarchy structure and
path scopes become second nature - and at the rate you seem to be
advancing, it shouldn't take long ;)
Maybe you are looking for
-
How do get my songs on my new iMac?
I just bought my son a new iMac..we have only ever had PC's...we have an itunes account with many purchases on it, when I open iTunes on the iMac and enter the account name and password, my account information (name, address, credit card info, etc) i
-
CJS-00091 Unable to create the tablespaces -R/3 4.7E installation
Hi All, We are installing R/3 4.7 Enterprise x200-SR1 release. While installing Database instance, SAPinst got terminated with the below error at tablespace creation step. CJS-00091 Unable to create the tablespaces. DIAGNOSIS: There is not enough f
-
Adapterframework missing in SLD technicalsystem type ExchangeInfrastructure
Hi Experts, All of sudden adapter framework was missing in SLD Technical system of type Exchange infrastructure, if any one had the same problem before can you please tell me how to resolve this, i already done following steps but no luck. Your Adapt
-
Some songs in shared library fail to play
I have my iTunes library on an external USB drive connected to a mac mini. The mini shares its iTunes library (iTunes 7.6) over the airport network, and I could successfully connect to it and play all songs on my macbook pro (also iTunes 7.6). I have
-
Can nowaday we can use playnsound or send message on find my iphone ? I use it before but now I can't find the bottom.. So i want to ask that did it still have or can use? If yes how to use ?