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
9 views

Where is the PHPTemplate in template files?

There is a default templating system PHPTemplate in Drupal, they say. But where can I see it? I don't see anything more than pure php in template files .tpl.php. Once I've seen template system ...
-3
votes
0answers
23 views

Convert this format ????? ????®, ??????? ???? to russian string; [on hold]

In my database which field i am getting,it is in russian language, when i fetch this field so it comes in question format I want to fetch in russian language.
1
vote
2answers
359 views

What is the difference between '<?php' and '<?' in source code? [on hold]

I have an old website which is not created by me. When I download the site to localhost, it causes errors which appear to be related to <?. When I change to <?php, the website can be displayed, ...
4
votes
1answer
40 views

Running Drupal 6 with PHP 5.3 and Maintaining Security

I have a number of Drupal 6 sites that I can't upgrade at this time due to sheer lack of time to do so (it would be a major overhaul). Therefore, I am required to continue running PHP 5.3 on my ...
1
vote
1answer
11 views

How to set all values of a field as body classes

I want users to easily modify the layout of a node by selecting options in a 'Layout' field that the node contains. The field is a entityreference field referencing taxonomy terms. (For example, the ...
0
votes
0answers
7 views

Allow tinymce in WYSIWYG to load different skins per content type

I want to user a different default tinymce editor styles per content type. I basically want to use a different default font in the editor area of tinymce per content type. I have discovered that the ...
0
votes
0answers
19 views

Part of foreach in tpl.php of the View acts strange

I created foreach in tpl.php of the View and it looks like this: <div class="carousel-inner"> <?php foreach($view->result as $result): ?> <div class="item active"> ...
0
votes
0answers
13 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
15 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. ...
0
votes
1answer
20 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
5 views

passing html output to response object in drupal 8

I had this: http://pastebin.com/C4Tz2fUv piece of code in a module developed for some previous version of D8 but now in present beta release it shows this problem: http://pastebin.com/C07Y0BDJ because ...
0
votes
0answers
20 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
18 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
46 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
41 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
47 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
172 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
24 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
6 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
21 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
8 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
41 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
18 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
22 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
14 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
0answers
22 views

Drupal views $title is null

I have created a view as a page and have set a title for it.Its works fine on the view preview but on the actual page its becoming null.The title also displaying on the title bar of the browser. I ...
0
votes
2answers
47 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. ...
0
votes
0answers
10 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
27 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
16 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
43 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
29 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
18 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
27 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
0answers
85 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
27 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
41 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
136 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 ...
0
votes
2answers
30 views

How do I get the user name of the user profile page that is being visited.

I created a module and I need to use the user name of the user's profile being viewed, how do I call/get it?
0
votes
0answers
19 views

display suite code - set token value of color field module as php variable an convert to rgb

$hex = "[node:field-ref-participants-category:field_color]"; print $hex; list($r, $g, $b) = sscanf($hex, "#%02x%02x%02x"); echo "rgba($r,$g,$b,.9)"; Why does $hex printed correctly, but doenst work ...
0
votes
0answers
13 views

PHP code & panels; how to transfer database code into module code [duplicate]

There are various blog posts on how to get php code in views out. See https://ohthehugemanatee.org/blog/2013/12/26/44497-people-are-wrong-how-to-never-use-views-php/ ...
0
votes
2answers
27 views

Coloring rows in returned drupal search results

I'm trying to modify search-result.tpl.php and template.php to color the backgrounds of search results returned such that every row has a different color than the one that preceded it. Only two colors ...
0
votes
0answers
28 views

Custom rules not working in an entity form

I have created an entity form with two integer data type text fields named Enter first number and enter second number. I save the entity form as greater of two. In the entityform > rules, I add a ...
2
votes
1answer
28 views

+1 user field after comment is made

I created a new user field to keep count of comments. I want to increase it by 1 after a user posts a comment and decrease it by 1 when comment is deleted. Is there any way I can use rules to do ...
0
votes
0answers
18 views

Drupal taxonomy-term text-body dependency

i'm using drupal for a website where i post from time to time different events. For this, i made a taxonomy type with four vocabularies, each stands for another event type. Now my question: I know ...