Custom Theme template in Drupal 7 - drupal-7

I know, if you want to check the names of the Display Output of the view page then we need to click on the Information Link near by Theme of Advance Theme of the view, it will list all the files.
After clicking on this, it will list.
Display Output : (View Machine name is add_to_cart)
views-view.tpl.php, views-view--add-to-cart.tpl.php, views-view--default.tpl.php, views-view--default.tpl.php, views-view--page.tpl.php, views-view--add-to-cart--page.tpl.php
So, could you please suggest which files should be best for creation of the Display Output template of the view page ?

If you want specific theming to your page display of add_to_cart view, then choose
to override views-view--add-to-cart--page.tpl.php.
I'll also want to add the importance of naming convention for templates, so that, next time, you can choose the template name yourself:
views-view.tpl.php: called for every view.
views-view--add-to-cart.tpl.php: called for only add_to_cart view.
views-view--default.tpl.php: called for the display: default(master display) of every view.
views-view--page.tpl.php: called for the display: page of every view.
views-view--add-to-cart--page.tpl.php: called for the display: page of only add_to_cart view. (the specific suggestions are always last)
Note:
Template naming suggestion flow: general to specific.
Also when you click the display output, you can copy the code for the template. This way you get all the variables that are available to you.
Hope this help else comment for queries.
Understanding how default, page comes in template names:
Within a view, you can create many displays as shown below.
Each display has a Machine Name, for eg: System display has a machine name: system_1. So, a view with system_1 display will be overrided using views-view--system-1.tpl.php. Note: the underscore('_') is replaced with hyphen('-'). The by default view display or master display in a view has a machine name: default.

Related

Salesforce Custom field in Edit Page ONLY

I wanted to display a custom field as Read-Only on the Edit page ONLY of a custom object. This field should be hidden on the detail page. I tried wrapping the field in a section and display the section in Edit Page only(Page layout editor). That didn't work. I don't want to create a custom visual force page for the EDIT Page. Please suggest.
Thanks
Kumar
Unfortunately, there's no way to put a field on just edit or just detail. It's both or neither.
You have two options, custom Visualforce page as an Edit override is the easiest one, but if you want to leave the page layout editor as something useful to admins, there's also a very hacky option...
Create two record types, one that displays the field and one that doesn't. Create a new button that launches a Flow (with a return URL of the edit page for that object). The Flow should change the object's recordtype to the one that displays the field. Additionally, create a Process or trigger that changes the recordtype back to the one that does not display the trigger after you save the object.
I definitely recommend the VF page...

Drupal 7 - how can I control content layout in a view?

I've been handed a design spec which requires a news listing in a specific format - e.g. image floating to the left, with the main title and content on its right.
I've created the articles listing using the views module and embedded the view as a block on the front page. However, I need to change the layout of the resulting list of items at an html level, as the items are not provided in the order or within the html tags that I need in order to deliver the design.
In order to style the output, I really need the views module to give me fine-grained control over the html tags being wrapped around each field for each article.
Is this possible in Drupal?
(edit: please note, this is not a css question - I know how to float and position things in css. I need to be able to modify the html tags applied to fields in a view - thanks!)
When you go to your view, you will see FORMAT. You can change the Format to HTML list with corresponding settings. Under Show, you will say Fields. In the FIELDS area, choose which content you want enabled. Let me know if this helps, or if you want more of an explanation. Go back into your view and click on your field. The next window that pops up should be to configure that field. You'll see style settings where you can define the HTML tags, classes, wrappers, etc.

how to use view ticker in drupal

Does anyone explain me how I can use Views Ticker.I loaded modul but no idea how I should use it.please explain me step by step ,I am new on drupal
thank you.I wanna do somethink like this link
enter link description here
Create a "content type" and name it anything in my own case I will name it "news"
To create a content type, navigate to administration->structure->Content type-> add content type
You can add new fields to the content type if you wish. But in my own case I will just use the default settings, since I need only the titles to appear as flash news headlines so click "save"
Next create a new view and name it anything in my own case I will call it "headlines"
To create a new view navigate to administration->structure->views->add new view,
Now setup the new view with the following attribiutes; {View Name = headlines, show = content, of type = news, sort by = Newest First, create a page = uncheck, display format = Views Ticker, of = Titles (Linked)", use a pager = unchecked, create a block = checked} now click save and exit
Next navigate to Blocks and enable the block we just created through the views. Check for the block name "headlines" and specify the location where you will like to place the newly added block and save.
To enable the block navigate to Administration->Structure->Blocks
Now Navigate to view and select the new view we just added. In my own case it is called "headlines" and make sure "Format" is set to View Ticker, you can customize the settings of the View Tick by click settings.
Next add a news content type using the content type we just created. Add a title, a summary and a content. Then hit save
To add a news content type, navigate to Add content
Tip: Add at least two news contents in other to see the full effect of the view ticker
There is "Some" documentation in the readme file. check it out and see if it fits your requirements, http://drupalcode.org/project/views_ticker.git/blob/refs/heads/7.x-2.x:/README.txt
From first glance it seems like a views plugin so you could probably try changing the dispaly in the views settings.
Yes, you need to create a new View that pulls in some kind of content (i.e. Announcements). Under the "Display Format" when creating the View, you'll see an option of "Views Ticker", if you've installed the module correctly.
Based on the example you pointed to, you'll probably want to create a Block at the same time, that you can insert into the desired region.
Once you've created the View, you'll see a link for the Display Format "Settings". This is where you choose whether to make it scroll horizontally, vertically, speed, etc.
Once you updated and saved the view, you should go Admin > Structure > Blocks and insert your newly-made Views Ticker block into one of the regions (regions available will vary based on your Theme).
Then, as long as your permissions are correct, and you have actual content,you should see the scrolling ticker show up on the page(s) where the block shows up.
To use views ticker, it needs you to have an view which outputs some data.
I assume you have such a view. Then go to that view's edit page and set format to views ticker. You should have enabled views ticker module to get that option to formats list.
Then it will show you the settings window, in which you can set settings such as vertically, horizontally, BBC, etc styles for your data movement and respective speed etc.
After you did, click on apply button and then save button top of the view's edit page.
If all goes well it should display moving contents in the page/block related to that view.

May I customize 'edit custom object records' page layout on SalesForce?

For example, to create or edit an object, when I want to add or change some value to one specific field, I need to refer another website to retrieve some info.In this way, may I add one button or link on the edit page?
The help link of SalesForce is here: https://help.salesforce.com/apex/htviewhelpdoc?id=co_edit.htm&language=en_US
Thanks.
Custom buttons and links don't display on new/edit page layouts so even if you'd make one, it will be visible only on detail view.
Not too invasive option would be to create a URL or text fied, set it's default value to your link, make sure it's displayed on the page but readonly. Haven't tried it but should work (you'll have to test it as somebody other than System Administrator because you'll bypass the readonly property of the page layout).
More invasive option would be to override the new and edit page layouts with Visualforce. More work but somewhat clean solution.
Really crazy option would be to embed a piece of Javascript into section header on the standard page layout or even into sidebar. It's an ugly hack but it works, I've used it for example to disable editing of Name field.
To use method #3:
create new section header, add something to the section (blank space is fine, you need something otherwise headers for blank sections aren't rendered), mark the section as visible on edit pages only.
Section name has limit of 80 characters but can contain code like <script>document.getElementById('Name').disabled = true;</script>. You need longer script though to somehow create an URL at runtime and append it somewhere on the page near your "special" field.
Upload a static resource with your script, then use this as the section header: <script src="filename.js" type="text/javascript"></script>
I'm not too proud of this hack and if you can - go with custom Visualforce new & edit page. It's quick & dirty, probably should be used only when you're not allowed to override pages.. but it works.

Visualforce Custom lookup visualforce page

I was wondering if there is a way to override the native functionality of the lookup field in Salesforce and replace it with a visualforce page. The reason I'm trying to override this button is because when the user does a look up, the look up returns everybody with that name. What we want to return is a list of all the contacts by account for the contact being searched.
Here's what I'm trying to achieve:
When the user clicks the lookup button my visualforce page will launch and allow the user to see the account and all the contacts of that account.
Is this even possible? What other ways would you suggest going about this?
Here's a screen shot of what I'm trying to change:
Thanks for all your help!
It sounds really like you just need to customise the columns on the lookup to make it better suited to your needs. If you go to Setup -> Customize -> Contacts -> Search Layouts, you'll see entries for Lookup Dialogs and Lookup Phone Dialogs, there you can edit the columns displayed in the lookup windows.
If you really need a custom solution:
You can't override the lookup page itself, but you could create a new visualforce page for your account, using <apex:detail> and other similar tags to make your life simpler. Then you could include a search section underneath, where a user can enter various search terms which you put into a dynamic SOQL query and then render the results for them to choose from.
yeah its possible by javascript as i did by visual force page that will show the records of related lists and upon selection id of that record passed to parent window by jscipt. and performed same functionality ..
As far as I know - NO.
As a workaround you can use JavaScript.
What we did in our situation? We implement everything in JavaScript. We created an inputText and right on the right of this inputText we placed image with this lookup icon. On image click we create ExtJS popup window (I think you can simply create VF page and show this page in popup window). After window was closed you fill in the inputText field.
There's no out-of-the-box override for this button, last I checked, so something custom would be required. If you're set on having a popup and do not want an inline solution, I'd recommend reviewing this tutorial to get familiar with some of the issues with popups in Visualforce.
But considering what you are looking to accomplish, you could also have your account and filtered list of all contacts associated with that account appear inline on your page when the user clicks a new, custom search button. Of course that page would itself be in Visualforce (or inline Visualforce in a standard page layout) - which you may or may not want to have to code and maintain.
The AJAX Toolkit might also be a good place to start if you want to go with a custom JavaScript button placed on a standard page layout.

Resources