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
0answers
18 views

Why does my module not seem to use cURL in one of my sites? [on hold]

I have 2 Drupal sites installed in different machines. For the first site, in status report in the list I have: cURL cURL library Enabled So only that row with cURL. For the second site, I have ...
0
votes
0answers
16 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
8 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
7 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
6 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
15 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
16 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
18 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
16 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
14 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
34 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
55 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
20 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
46 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
18 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
15 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
14 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
20 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
68 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
22 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
29 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
12 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
62 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
50 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
59 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
231 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
25 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
14 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
24 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
9 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
56 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 ...
0
votes
1answer
22 views

How do I separate multiple values for “print render($content['field']);” with a comma?

So in my node template, I am using the following code: print render($content['field_taxonomy']); Sometimes there is only one result printed, and sometimes there are multiple results printed. How ...
0
votes
0answers
23 views

Why is Drupal commenting part of my php code?

I have a block that is being executing some php code and when I enable my block on my site the first couple of php lines are commented out. <?php global $user; if ($user this turns into this ...
0
votes
1answer
15 views

Want to process node edit in two different ways

On every node page there is an edit and submit, you can set when the edit is available and such. So, what I want to do is this. When a regular user uses the edit button(which I want to be available ...
0
votes
2answers
74 views

Passing variables via template.php for search module

I'm using search.module. I used dpm(get_defined_vars() ); in my search-results.tpl.php file to see all returned variables, so I can reference a needed variable in some PHP code I'm writing in there. ...
1
vote
1answer
21 views

bookmark organize for anonymous user permission

I have use drupal 7. I download and install the flag , flag bookmark, bookmark module.I have also add settings for bookmark. Bookmark functionality is work for authenticated and admin user. i wanna ...
0
votes
0answers
28 views

Trying to customize login page for mobile, interfering with desktop version of login page

I've been trying to customize the login/retrieve password/create account pages on the mobile version of my website for a couple of weeks now with little success. I haven't found a satisfactory answer ...
0
votes
0answers
4 views

Drupal 6 cck field update

In Drupal 6, want to update cck field. For example, have a content type 'question' with field 'question_description'. Try to update this field as following. load in the content of content type ...
0
votes
0answers
21 views

ahah fields in custom form stopped working after migration

I migrated my drupal 6 website to a new machine. my custom form with ahah-fields are not working in the new server. OLD => NEW ............................ ubuntu => 9.10 => ...
0
votes
0answers
57 views

Problem getting Drupal SESSION value from standalone php page in subdirectory

Last 2 days I am searching for solution on Internet. I have a module in my drupal site's "sites/all/modules" folder named "coupon".I added a new test.php file in the "coupon" folder which has no ...
0
votes
1answer
39 views

Creating a dynamic URL in node--resource.tpl.php

I'm trying to create a URL in my node--resource.tpl.php file that contains fields from the resource in question in the URL. The following code is what I've been playing with, but when the user clicks ...
0
votes
0answers
22 views

Using substr() with Drupal search-result.tpl.php returning fewer characters than expected

In my search-result.tpl.php file I want to return only the first 200 characters of the body field before outputting it to the screen (assuming there are that many characters). I'm trying to use the ...
0
votes
1answer
21 views

Using Left() with Drupal Custom Module

I'm trying to return only the first 200 characters (if there are more than that) from a body field in a Drupal custom module. I've found the general php/mysql solution here: ...
2
votes
1answer
32 views

Drupal 7 Comments Alternating Row Colors

I'm interested in making the comments that appear on my resource content type nodes show with alternating background colors. Anyone know how to make this happen? I tried something like this with CSS ...
0
votes
1answer
146 views

Trying to theme my user login/registration/password reset pages in Drupal 7, going bonkers

What seems like it should be a very, very simple task -- theming the user login, registration, and password pages in Drupal 7 -- is turning out to be a Kafka-esque nightmare. I can't figure out what ...
0
votes
0answers
30 views

To use some hook instead of “PHP contextual filter code” in view

Can anyone please give a solution on having a substitution of "PHP contextual filter code" for views, inside a module code?
0
votes
3answers
54 views

Redirect user based on role and node content

I want to redirect a user when they login based on what role they have and whether they have created a node of a type. So if the user has administrator role, direct user to admin url else if the ...
0
votes
1answer
35 views

How to load a field from a user that is being viewed

I am looking to load a field from a user's profile that is being viewed.For example, I am looking at another users profile and it will load their associated field. I am programmatically adding a ...
1
vote
2answers
197 views

First page load/execution slow, login slower Drupal 7

Drupal 7 site experiencing slow execution/load time for first page visit and slower execution/load time for login. The web server and database servers are dedicated and well resourced, the site has no ...