Hey all,
I have a nodequeue set up and I threw some php code in a block to display the nodes I want... This all worked great for me until I updated the site to the latest Drupal 5.22 and all of a sudden I'm getting an error : *Parse error*: syntax error, unexpected T_VARIABLE in */includes/common.inc(1497) : eval()'d code* on line *1*
The code for the block is : <?php$get_nodes = db_query("SELECT * from nodequeue_nodes WHERE qid = 1 ORDER BY position DESC limit 3");$count = 0;while ($node = db_fetch_object($get_nodes)) { $count = $count + 1; $full_node = node_load($node->nid); if ($count == 3) { print node_view($full_node); } else { print node_view($full_node); }}?>
I have the latest Drupal 5.x version of all the modules and core. My theme is not getting in the way I don't think... Any thoughts as to why I'm getting this error instead of my block displaying properly??
Jake Roufa 208.557.9390 http://jacobroufa.com
On May 31, 2010, at 2:47 PM, Jacob Roufa wrote:
I have a nodequeue set up and I threw some php code in a block to display the nodes I want... This all worked great for me until I updated the site to the latest Drupal 5.22 and all of a sudden I'm getting an error : Parse error: syntax error, unexpected T_VARIABLE in /includes/common.inc(1497) : eval()'d code on line 1
Put a space between your opening <?php and $get_nodes.
Consider using nodequeue_load_nodes() which does much of this work for you. Also, you forgot braces around the table name {nodequeue_nodes} and a more standardized way to use the counter is an iterator ($counter++;) rather than $counter = $counter +1;
-D
Nodequeue has pretty good Views integration. You're probably much better off using that instead of writing your own code, even in Drupal 5. It will be much more stable.
--Larry Garfield
On Monday 31 May 2010 04:47:35 pm Jacob Roufa wrote:
Hey all,
I have a nodequeue set up and I threw some php code in a block to display the nodes I want... This all worked great for me until I updated the site to the latest Drupal 5.22 and all of a sudden I'm getting an error : *Parse error*: syntax error, unexpected T_VARIABLE in */includes/common.inc(1497) : eval()'d code* on line *1*
The code for the block is :
<?php$get_nodes = db_query("SELECT * from nodequeue_nodes WHERE qid = 1 ORDER BY position DESC limit 3");$count = 0;while ($node = db_fetch_object($get_nodes)) { $count = $count + 1; $full_node = node_load($node->nid); if ($count == 3) { print node_view($full_node); } else { print node_view($full_node); }}?>
I have the latest Drupal 5.x version of all the modules and core. My theme is not getting in the way I don't think... Any thoughts as to why I'm getting this error instead of my block displaying properly??
Jake Roufa 208.557.9390 http://jacobroufa.com
Thanks for the help guys! I took your advice Dom and put in the space and braces and it works great. Also going to try out the nodequeue_load_nodes() later on. The code I had was created by a dev earlier than when I took on the site so most of the work on it is very definitively not Drupal-y... Workin' on cleaning it up! Also, Crell, I did use a view at first but it didn't display the way I wanted and just figured instead of trying to make another block-something.tpl.php and theming it from there I would just try to fix the code. Thanks though! When I update to D6 I'll be using more Views for sure. :)
Cheers! Jake
Jake Roufa 208.557.9390 http://jacobroufa.com
On Mon, May 31, 2010 at 10:15 PM, Larry Garfield larry@garfieldtech.comwrote:
Nodequeue has pretty good Views integration. You're probably much better off using that instead of writing your own code, even in Drupal 5. It will be much more stable.
--Larry Garfield
On Monday 31 May 2010 04:47:35 pm Jacob Roufa wrote:
Hey all,
I have a nodequeue set up and I threw some php code in a block to display the nodes I want... This all worked great for me until I updated the site to the latest Drupal 5.22 and all of a sudden I'm getting an error : *Parse error*: syntax error, unexpected T_VARIABLE in */includes/common.inc(1497) : eval()'d code* on line *1*
The code for the block is : <?php$get_nodes = db_query("SELECT * from nodequeue_nodes WHERE qid = 1 ORDER BY position DESC limit 3");$count = 0;while ($node = db_fetch_object($get_nodes)) { $count = $count + 1; $full_node = node_load($node->nid); if ($count == 3) { print
node_view($full_node);
} else { print node_view($full_node); }}?>
I have the latest Drupal 5.x version of all the modules and core. My
theme
is not getting in the way I don't think... Any thoughts as to why I'm getting this error instead of my block displaying properly??
Jake Roufa 208.557.9390 http://jacobroufa.com
-- [ Drupal support list | http://lists.drupal.org/ ]
I am an Eclipse PDT newbie, so apologies if my questions are basic.
THE ENVIRONMENT ================ I have set up Eclipse PDT 2.1.3 with xDebug and I am trying to debug a Drupal application with LAMPP on Ubuntu via my localhost. I have installed the Drupal Plugin for Eclipse.
I have set breakpoints in page-front.tpl.php and page.tpl.php and the debugger stops in the files where expected.
THE PROBLEM ============ However, I have set a breakpoint in a node-product.tpl.php file (derived from node.tpl.php) but when I click Run > Resume and I navigate to the correct page in the browser window, the debugger just refuses to stop execution in it. At this point under Run, the only command highlighted is Terminate, so I don't know where in the application I am at present.
If the application is still executing, how do I break out of the loop and get back control so I can start debugging?
Secondly, I am not certain why I am not able to get into that file and perhaps there's a good reason I am not aware of. This is my primary aim here.
Also, my Firefox External browser opens when I initiate a debug session, but there doesn't seem to be a relationship between Run > Step Over (F6) and what I see in the browser window. The browser is expecting user input. How do I coordinate between the browser and the Eclipse IDE so it's interactive between the two? An action in one makes it pause or continue in the other. That means, when I click in browser window, it should show me where I am in the debugger.
I have one more question. When I start a Drupal debugging session most people set up the Run > Run Configurations to start at index.php. My question is can I start a debug session at some arbitrary URL address or does it always have to begin with a .php file? How about a .tpl.php file located not in the htdocs folder, but in the theme folder itself? Should it be a .tpl.php file, or can it be a URL address?
I know these are basic questions, but any leads would be appreciated.
Hi Moses,
If you're getting your debugger to stop at all then most of your setup must be fine. Are you sure that your node-product.tpl.php is being called? Maybe throw a print_r or something in it to make sure. I know that I have seen bugs around node template suggestions not being used unless node.tpl.php is in the same file. If the only command is terminate then all server side processing is done usually. Is the page rendering?
You won't see anything in the browser until Drupal has finished processing everything, this is mainly because all the work goes into building up an output string and the last thing that index.php does is basically just write that string out. At this point control goes back to the browser until something (a page navigate or a submit) sends control back to the server and it all goes through it again. It will only then stop if where you're sending it to has a breakpoint set up.
I'm pretty sure it has to be a php file, but don't quote me on that. I think I once tried to get it to launch to a html file for a non Drupal project but didn't have much luck. The main reason it's index.php that needs to be called is that index.php does a call to drupal_bootstrap so that all it's variables and database access is set up so calling to another file wouldn't really work.
HTH. Anthony.
On 6:59 AM, Moses Elias (2) wrote:
I am an Eclipse PDT newbie, so apologies if my questions are basic.
THE ENVIRONMENT
I have set up Eclipse PDT 2.1.3 with xDebug and I am trying to debug a Drupal application with LAMPP on Ubuntu via my localhost. I have installed the Drupal Plugin for Eclipse.
I have set breakpoints in page-front.tpl.php and page.tpl.php and the debugger stops in the files where expected.
THE PROBLEM
However, I have set a breakpoint in a node-product.tpl.php file (derived from node.tpl.php) but when I click Run > Resume and I navigate to the correct page in the browser window, the debugger just refuses to stop execution in it. At this point under Run, the only command highlighted is Terminate, so I don't know where in the application I am at present.
If the application is still executing, how do I break out of the loop and get back control so I can start debugging?
Secondly, I am not certain why I am not able to get into that file and perhaps there's a good reason I am not aware of. This is my primary aim here.
Also, my Firefox External browser opens when I initiate a debug session, but there doesn't seem to be a relationship between Run > Step Over (F6) and what I see in the browser window. The browser is expecting user input. How do I coordinate between the browser and the Eclipse IDE so it's interactive between the two? An action in one makes it pause or continue in the other. That means, when I click in browser window, it should show me where I am in the debugger.
I have one more question. When I start a Drupal debugging session most people set up the Run > Run Configurations to start at index.php. My question is can I start a debug session at some arbitrary URL address or does it always have to begin with a .php file? How about a .tpl.php file located not in the htdocs folder, but in the theme folder itself? Should it be a .tpl.php file, or can it be a URL address?
I know these are basic questions, but any leads would be appreciated.
Hi Anthony,
Your advice was spot on. I had mapped a path incorrectly because I had hard-coded a URL link in template.php and the URL in Eclipse that was being called was being redirected to the wrong location. The print_r advice led me to right conclusion.
Second, in Eclipse the externally configured Firefox browser wasn't interacting with the debugger as expected because I opened and shutdown the browser at the end of each debugging session. Now that I've stopped shutting down the browser after each debugging cycle (and left the browser window open) that problem has gone away too.
Third, according to Chris Charlon you can debug any arbitrary URL and you don't have to always start your debug session from index.php. However I haven't had the time to check it out yet. Chris says:
You can debug a single URL, you must change the project settings
(right-click > properties). You can save multiple "web servers" >> in a project, so you can have one for index.php and one for any other URL you're concentrating on.
When debugging a template you must visit a node to see it in action,
usually.
Lastly, and here's another question. I am also wondering why Step Filters in Eclipse PDT don't seem to work. From what I have read so far it hasn't been implemented thus far, but I just wanted to confirm this myself because it would be a great effort saver if Step Filters were implemented as expected, and you exclude certain source directories, while you're debugging.
Thanks for your help.
Moses
On 02/06/2010 11:37, Anth wrote:
Hi Moses,
If you're getting your debugger to stop at all then most of your setup must be fine. Are you sure that your node-product.tpl.php is being called? Maybe throw a print_r or something in it to make sure. I know that I have seen bugs around node template suggestions not being used unless node.tpl.php is in the same file. If the only command is terminate then all server side processing is done usually. Is the page rendering?
You won't see anything in the browser until Drupal has finished processing everything, this is mainly because all the work goes into building up an output string and the last thing that index.php does is basically just write that string out. At this point control goes back to the browser until something (a page navigate or a submit) sends control back to the server and it all goes through it again. It will only then stop if where you're sending it to has a breakpoint set up.
I'm pretty sure it has to be a php file, but don't quote me on that. I think I once tried to get it to launch to a html file for a non Drupal project but didn't have much luck. The main reason it's index.php that needs to be called is that index.php does a call to drupal_bootstrap so that all it's variables and database access is set up so calling to another file wouldn't really work.
HTH. Anthony.
On 6:59 AM, Moses Elias (2) wrote:
I am an Eclipse PDT newbie, so apologies if my questions are basic.
THE ENVIRONMENT
I have set up Eclipse PDT 2.1.3 with xDebug and I am trying to debug a Drupal application with LAMPP on Ubuntu via my localhost. I have installed the Drupal Plugin for Eclipse.
I have set breakpoints in page-front.tpl.php and page.tpl.php and the debugger stops in the files where expected.
THE PROBLEM
However, I have set a breakpoint in a node-product.tpl.php file (derived from node.tpl.php) but when I click Run> Resume and I navigate to the correct page in the browser window, the debugger just refuses to stop execution in it. At this point under Run, the only command highlighted is Terminate, so I don't know where in the application I am at present.
If the application is still executing, how do I break out of the loop and get back control so I can start debugging?
Secondly, I am not certain why I am not able to get into that file and perhaps there's a good reason I am not aware of. This is my primary aim here.
Also, my Firefox External browser opens when I initiate a debug session, but there doesn't seem to be a relationship between Run> Step Over (F6) and what I see in the browser window. The browser is expecting user input. How do I coordinate between the browser and the Eclipse IDE so it's interactive between the two? An action in one makes it pause or continue in the other. That means, when I click in browser window, it should show me where I am in the debugger.
I have one more question. When I start a Drupal debugging session most people set up the Run> Run Configurations to start at index.php. My question is can I start a debug session at some arbitrary URL address or does it always have to begin with a .php file? How about a .tpl.php file located not in the htdocs folder, but in the theme folder itself? Should it be a .tpl.php file, or can it be a URL address?
I know these are basic questions, but any leads would be appreciated.