How to change page code in Drupal? - drupal

I need to change page site_name.com/user/sites (Add button, for example). Where can I find its code? I tried to search in site_name.com/admin/modules but there are too many of them.
EDIT: Sorry, the question is closed. After day of struggle I gave up. Drupal is not for me.

You can consider creating a template file for that page. Try using page--admin--modules.tpl.php.
Check this out: http://drupal.org/node/1089656

/user templates are found in the user module. You can find 4 user templates there.
To know which one to override you can use the Devel Themer module.
It provides you a checkbox at the bottom of the page and when enabled it shows the candidate preprocess functions and template files for particular regions. (As described on the module page, only enable the module is needed because it can mess up the lay-out of some pages.)

Related

Drupal know from where things are showed

I have a strange question but I don't find any hint about that (if it's possible), for a drupal 7 website I have to modify some content of a page in the backoffice, but I really don't know from where some content of this page is created (a table, similar to a view table but not a view table).
I just want to know if there is any way to show which php function the page use to finally be showed. I know there is something like that for the theme (drupal theme debug) but I don't find something for my case.
Any idea ?
You need PHP profiler to check all functions called on page, there's a module for Drupal7 for XHProf integration. But I would suggest you to use your browsers inspector as mentioned by 2pha before. For example if there's a form on the page just use the form ID to find it. Custom classes are very useful in these cases, parts of the html codes etc. In your case search for table headers...
The code you are looking for is most probably in custom modules and the
general suggestion is to keep you custom modules in separated folder from contributed ones.

remove plugin on specific template page

I am using http://wordpress.org/extend/plugins/pdf24-post-to-pdf/ pdf generator plugin for my site, but I only want it present on certain pages.
How can I remove it from all pages except a certain template I allow?
I believe this can be done with filters, but I have googled and googled and can't seem to get anywhere.
I don't think that's possible without modifying the plugin source code. That would be a nice security issue, IMO.
Plugins are files simply included on the loading process. At least, there's no hook I could find on WordPress source code for you to interfere in this behavior. Take a look just above the plugins_loaded hook, and the wp_get_active_and_valid_plugins function.
What you can try to do, instead, is just modifying the plugin with the condition you need. In the top of the pdf24.php file, just below the standard comments, put:
if (!condition_met())
return;

Creating a custom contact page -- page-contact.tpl.php

I'm new to Drupal. I want to create a contact page, so I copied page.tpl.php and renamed it to page-contact.tpl.php. I created some new elements in the page, so I can see that if I click on the "contact" link, I'll know that I went to the correct page.
Right now I don't see any change. Was there something I missed? Do I need to do something in the admin settings so Drupal knows which file I need to open?
I also tried clearing my cache.
In theory, this is a valid approach. Problem is, you'll be able to create a new layout for your contact page this way, but not necessarily change the contact form. If you wish to alter the form as well, I'd recommend using the webform module. It's pretty flexible when it comes to creating contact forms, plus, it creates a node, so you can style it with ease (either in you standard node.tpl.php or - even better - in node-webform.tpl.php). This is what I usually do.
There might be other solutions too, but it would help if you made it clear what kind of alterations you wish to introduce in your contact page.
When you say cleared my cache do you mean the browser cache or drupal's cache? Ensure drupal's theme registry has been cleared by going to /admin/build/themes, or logging out and back in.
I also recommend trying the webform module as mingos suggests.
Drupal core's built in contact module does not use any templates, so you'll have to use something like Webform if you want a per-contact template.

Drupal, CKEditor: custom formatting options issue

For some reasons the checkboxes in "custom formatting options" are always selected. Even if I unselect them and save them, they remain selected.
Screenshot: http://dl.dropbox.com/u/72686/customFormattingOptions.png
Could you explain me why ?
thanks
Sounds like the form is not submitting properly, and just keeps using the old values. As a temporary fix, you can either:
Debug the module's PHP code and fix the form submission yourself
Or look in the database and manually make the necessary changes to the configuration (might be in the variable table or in a custom table created by the module itself)
As a more permanent solution, I'd file a bug in the module issue queue for the module you're using to integrate CKEditor on your site. If you tell us what version of Drupal and what module (and its version) you're using to integrate CKEditor with Drupal, someone here might be able to debug the code as well.

How to theme a view in drupal

Can any one help me out on how to theme a view.
For each view created i want to have different templates.
Theming views can be somewhat tricky, depending on the kind of views you have created and the changes you need to make. Check out this introduction for Views 2, and make sure to install the Advanced Help module to get at the views2 documentation from the views module itself (there will be a link to the documentation on your views overview and edit pages, once you activated the Advanced Help module).
You can also find some questions/answers here on SO (e.g. Drupal 6: How to quickly theme a view?), if you search a bit.
I actually did this the other day. Ill give you a brief overview and expand a little later.
Set up your view; by going to Views -> Add View
Once, your view is completely set up, at the bottom of the view (left column in D6, right-most "Advanced" column in D7), you will see a link called "Theme: Information", click on it.
What you will be presented with is a list of templates (.tpl.php) files that the views uses to theme your data. Basically the file names that are bolded are the files views is using to theme the data.
To Customize Your Views
Select the page you need to theme. For Example, if you created a "Block" view, and I wanted to customize the basic html layout, I would pick a name (other than the one that is currently bolded) that is being displayed to me and create the file in my themes directory (sites/all/zen/custom-file-view-fields-views.tpl.php) - this is if views told me that I could use the filename custom-file-view-fields-views.tpl.php
The next step is knowing what code you need to put in there. The quickest way, is to go back to the theming information in views, click on the link of the file your replacing and grab the code that is presented to you. Paste that code in the file you created.
From here on out, you can now successfully customize that view.
Keep in mind that the theming information presented to you is presented from basic to complex (up to down). So choose which file you need to edit carefully. Ill put up some images in this answer a little later.
Hope this helps! Cheers!
Is there something specific you're trying to accomplish? There's a lot of ways to "theme" a view, unless you mean "theme" in the strict Drupal sense.
Personally I just give the fields classes and use those, rewriting the output to include variables as classes if need be. This tends to be easier and more manageable than modifying TPL files directly.

Resources