Questions about PHP not related to Drupal should be asked on Stack Overflow. Don't use this tag to generally mean "the question is about PHP code."

learn more… | top users | synonyms

0
votes
1answer
29 views

Web Service Client - Changing SOAP-ENV: into soap:

This is reference to issue that I have with Web service client module, here is link to the previous issue: https://www.drupal.org/node/2508926 Overall I'm trying to change the REQUEST from POST ...
-1
votes
0answers
3 views

drupal commerce code to upload translated product manuals into site

PDFhow to write a code which uploads product manuals PDF's into site according to the products sku. example i want manuals according to sku,if product sku is T1234,T5678 product manual field should ...
1
vote
2answers
19 views

How to show a block on user profile edit page ?

I am trying to display a block on an user edit page (example: user/123/edit/custom_url, but for some reason, I can't seem to get it working. Any help is appreciated. I tried this, but this isn't ...
0
votes
0answers
10 views

How to get session user id in custome php file [duplicate]

I want user session id in my custom ajax file named "ajax_page.php" below is code that i have placed in that file but i am not able to get object array of $user that i'hv defined as Global $user. ...
0
votes
1answer
19 views

how to calculate a value by rules

I have three fields in a content type and want to calulate sum of them in another field. First, I use Computed Field but it does not work at all. Then I tried to use conditional field but it is not ...
0
votes
0answers
10 views

Check if text contains internal url

I have a text field where users can submit text. I would like to restrict possible urls only to urls that are on same domain. Is there any function that would check if such the url belongs to a node? ...
0
votes
0answers
8 views

Drupal 6 Track step by step performance / execution time

Drupal 6 site is slow. Want to track performance / page execution time. - check each step, PHP code, execution time - check JavaScript execution time - check CSS execution time Krumo prints out the ...
2
votes
2answers
41 views

What is the best way to add my custom PHP functionality to a Drupal homepage?

I have a custom PHP application I've written that accesses an API via SOAP, processes some data from the web service, and outputs an HTML table with the results. I'm an experienced WordPress developer ...
0
votes
0answers
15 views

Date format - @ symbol has unexpected behaviour

I created a date format , then added that date format to a field within a view. But the @ symbol is automatically appending to the end of the date format (even though i specified it to go into the ...
0
votes
1answer
15 views

Template hierarchy like Wordpress in Drupal 7+

I am new to Drupal. Is there any template hierarchy structure to output different section of durpla like node, page, vocabulary, block etc. If so how can we use that. E.g. In WordPress we have a ...
0
votes
1answer
25 views

How to add PHP to a node without php filter?

I have a one-off page on my site (webcam), where i need to run some php to eg. calculate today's sunrise time, add a daylight image at night, etc. I understand PHP Filter is a security risk, and not ...
0
votes
1answer
21 views

Fatal error: Cannot redeclare _PEAR_call_destructors() (previously declared in /usr/share/php/PEAR.php:735) [closed]

Fatal error: Cannot redeclare _PEAR_call_destructors() (previously declared in /usr/share/php/PEAR.php:735) in /var/www/quest-cms-dev/sites/all/modules/civicrm/packages/PEAR.php on line 811 ...
0
votes
0answers
8 views

Theme function not working in module with multiple forms

I have following code for my module it has two forms form-example displayPenCard The following code calls the theme function (theme_form_example_form()) and it gets rendered, which is the theme ...
0
votes
1answer
28 views

Should I Unset PHP variables in Drupal?

We all know php's variables(array, integer,string) would be taking large memory. So PHP recommend to unset the variables to optimize the memory. Should I do that in Drupal too ? or Is Drupal ...
2
votes
2answers
16 views

Drupal: How to Access the value of a field of the current node

Within hook_views_query_alter(), I'm trying to access the value of a field of the node currently being displayed. I have added a contextual filter which should give me the nid of the current node. ...
0
votes
0answers
32 views

500 error in a Drupal module: “malformed header from script”

I am debugging an error in a specialized module in Drupal 7; basically, the module receives a HTTP POST request from a remote banking system, and needs to store that data and return an "OK". The ...
0
votes
2answers
14 views

pager is not working when print views

I've created one view with used of php code for some fields in it, and set pager on it too. It's working fine whenever i created given link of view but actually I print that same view on another basic ...
0
votes
1answer
18 views

Assigning global var to session variable?

This must be simple. I want to assign the user name to a SESSION variable, yet this is not working. $_SESSION['loveleytest'] = $user; $_SESSION['thelovelytest2'] = $user->name; What ...
0
votes
0answers
25 views

Incorrect Login Notification Missing using user-login.tpl.php

I've customized my logged in user page using a template file in D7 (user-login.tpl.php). Problem I can't figure out is that if they type in the wrong login/pass, it just reloads the page and there is ...
0
votes
0answers
18 views

problem accessing user variables in rules

I use module rules linkevent https://www.drupal.org/project/rules_linkevent to trigger a rule based on visited path. Tha problem I have that in condition I need to use user variables but get an error ...
1
vote
1answer
22 views

passing argument into markup(renderable array?)

I'm doing the Drupalize.me Drupal 7 module course. We're building a function in an include file that takes and argument from the URL. It then prints the value to the page. Seems simple enough, but ...
0
votes
0answers
10 views

changing default product price programmaticaly if and only if skus match between code and default skus

using http://stackoverflow.com/questions/13491983/drupal-commerce-line-items-alter-the-price/21395149#21395149 by Tim Yao I am able to change default price in cart for all products with same price ...
0
votes
0answers
8 views

empty value inside rules component

I have a simple rule with action calling a component. This action provides one argument value coming from a field (field can have a value or can be empty). Component, among other things, displays a ...
0
votes
0answers
7 views

Drupal file naming convention [duplicate]

I have to extend a Drupal project management project, and since I've only been working with PHP for not too long, I'm not very familiar with PHP naming convention, and practices, such as having an ...
1
vote
1answer
34 views

Display Suite Custom Template Issues

I've been using Display Suite for Drupal 7 (with Bamboo theme,) and I'm trying to build a layout template that contains 5 rows, so I can place the appropriate fields into each row, making all content ...
0
votes
1answer
21 views

Two Blocks for sort filter Views — Drupal 7

I have a view in Drupal 7 with results including a field of date and another with price, I need to sort the results by means of these two fields when I click on the appropriate link (not button or ...
0
votes
1answer
30 views

Using base_url() in image paths without using PHP?

So normally I can do <img src="<?php base_url(); ?>/default/files/image.png" /> and that works just fine if I enable the php filter. The trouble is that enabling the php filter disables ...
0
votes
1answer
24 views

Using PHP 5.2.17 in Acquia Dev Desktop 2

I'm using Acquia Dev Desktop 2 with Drupal 7. On PHP version selection menu, I only see "5.3.29", "5.4.33", "5.5.17". Is it possible to switch PHP version to PHP 5.2.17 since most of my hosting ...
0
votes
1answer
21 views

XHProf not displaying runs but empty table

I'm trying to profile a drupal website using xhprof. I manage to install it and configure drupal to use it (using the devel module) but I have a problem to visualize the result. First, for some ...
2
votes
1answer
41 views

How to hide comment section present in render array?

I have generated an array in Drupal 8 which is created by using viewbuilder in this manner: $content = $this->entityManager()->getViewBuilder($entity->getEntityTypeId())>view($entity, 'hardcopy'); ...
1
vote
2answers
120 views

How to use views replacement patterns while using the PHP filter?

In views, when using the standard text formatter you can place replacement tokens such as [title] into the HTML code either in a rewrite or in this case global text for Drupal to render. In this ...
2
votes
1answer
24 views

Why is my field not showing up in the template?

I created a new field of the type Link for the Basic page content type and the field name is field_secondary_links. All the pages on the site operate based on custom templates and I edited ...
1
vote
2answers
55 views

Okay to use PhP include() in body of basic page? [closed]

Aside from the usual warnings about using PhP, which I understand and am taking seriously, is there any drawback to using the PhP include() function in the "Body" box of the "Edit Basic page" form? ...
0
votes
0answers
25 views

drupal 7 site server log says there is PHP Fatal error

I have Drupal site and this is the server error: PHP Fatal error: require_once() [function.require]: Failed opening required ...
0
votes
0answers
22 views

Create main page content block

I use drupal 6 and need to create main page content block - same as in drupal 7. I need it so I can reorder blocks that show on page. Without main content block I am not able to move some blocks over ...
0
votes
1answer
15 views

Process Array contents

I've done a database query which returns the results in the following array: Array ( [0] => stdClass Object ( [field_latitude_value] => 25.2000000000 ) [1] => stdClass Object ( ...
0
votes
2answers
29 views

Importing products into Drupal Commerce error

I am currently trying to import about 20000 products into drupal but around 11000 products I get this error: An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. ...
1
vote
2answers
168 views

drupal 7.35 .htaccess: Invalid command 'Order', perhaps misspelled or defined by a module not included in the server configuration

I'm trying to deploy an instance of drupal with cloudfoundry. Everything loads up and seems to start correctly, but when I try to hit the page I get the following error in the logs: ../.htaccess: ...
0
votes
0answers
28 views

Commerce add product to cart while not logged in

Here is my question : Context : I made a TPL page with a products list, you select one of theme and click on submit. Then there's an ajax call to a PHP script wich adds the product to cart. Problem ...
0
votes
1answer
46 views

Drupal calendar popup - Year dropdown not showing in colorbox - Screenshot added

I am using drupal calendar pop up in colorbox.when i clicked on year its not showing year dropdown but giving js error of TypeError: m.replace is not a function Above issue is coming in Firefox only. ...
0
votes
1answer
13 views

Conditional for view template [closed]

<?php if ($rows): ?> <div class="view-content span12"> <?php print $rows; ?> </div> <?php elseif (($rows) AND ($exposed)) : ?> <div ...
0
votes
1answer
95 views

Array and Select Options

I have the following code working together with a scrip that populates fields on autocomplete. What I would like to do is instead of having an autocomplete text box - use the city field in a drop ...
0
votes
3answers
55 views

Redirect to page before login

Now i know there are some ways that a redirect on login can be setup, ie using views etc, but i think my issue maybe a bit more complicated. When a user accesses a node for example where they are ...
1
vote
2answers
75 views

Convert a drupal website to standalone exe file

I'm trying to convert my Drupal website to a standalone .exe file. I tried some popular applications like ZZEE PHPExe or ExeOutputPHP, ZZEE PHPExe returns the error that /includes/boostrap.inc is not ...
1
vote
1answer
324 views

Google Drive Integration with Drupal

I need to Integrate my Drupal site file field with Google Drive. Public User(Annonymous user in drupal) will be selecting a file from their Google Drive which should be attached automatically to ...
0
votes
1answer
26 views

What does -> mean in the context of Drupal [closed]

I see a lot of variable declarations that go something like this: $variables['classes_array'][] = drupal_html_class('node-', $node->type); What does '->' mean in $node->type and why can't we just ...
0
votes
0answers
27 views

join two tables and take 20 distinct values without the use of “distinct()”

how i can join 2 tables and keep the first 20 different values in the table?I create a table with no values on module installation: function distinct_schema() { $schema['distinct'] = array( ...
0
votes
2answers
31 views

Question and Answer web page idea [closed]

I am making a website and i'm trying to add a Q and A page where questions can be asked but how would I add it where each questions have their on divs and comments sections are allowed under the ...
0
votes
0answers
16 views

Field permissions combined with content type

I use module field permissions to restrict/enable role's access to certain fields. The editor role creates and edits articles. I reuse field_terms (taxonomy field) in multiple content types ...
0
votes
2answers
85 views

How do you get DRUPAL_ROOT when using it in a separate php file?

It has been covered many many times on several sites, explaining how to define DRUPAL_ROOT and bootstrap the page (whatever that actually means). However no one has ever said how to use it in a ...