Drupal 7 add block of text to front page - drupal-7

I'm new to Drupal but I've found my way around it pretty easily. There's just one thing I haven't found out how to do, and it's so simple it has to be possible.
I created a template for the site's homepage as it will have a different layout (did it creating page--front.tpl-php). This page will display only the main menu, an image and a text of the company's mission statement. I've done everything but the mission text and I have no idea how to do just that: simply put a block of text there.
I know I can hard-code it on the HTML but I want my client to be able to change it eventually if he wants to, in a graphic way. I tried creating a content type but I can't remove the title field and some submitted info; I thought of using Views but it seems too complicated for what I need, isn't it?
The image I used is hard-coded on he HTML as I know it won't change, but maybe I should have created a view with both the image and the text? But then how would I get rid of the title field and submission info?
Can someone please suggest the best way, if possible, to do this? Perhaps I'm over-complicating.
Thank you.

The easiest way would be to create a region in your theme and then put a block into that region only on the home page.
In mytheme.info:
...
regions[front] = Front Page Text
...
In page--front.tpl.php:
echo render($page['front']);
Then in your blocks administration page create a block and assign it to the "Front Page Text" region with the content you want to output. You could also limit the block's visibility to <front> if you want to be sure, although if you don't output that region in any other template file it shouldn't make a difference.

Related

How to refrest the content of a page using cakephp?

I wanna refresh the content in a page, for example like when you like a photo in facebook, you can notice the text change from like to not like and the number of likes increase or decrease.
I'm doing using a redirection to the controller, the problem is that the page go to the beginning and I don't want that. anyone know what I need to do to stay in the same part of the page and that the fields changes?

field label can not be hidden in drupal

I use the bartik theme in drupal7 as the default theme.And I completely override the page.tpl.php file.
design a two columns layout : the lefsidebar and the contentArea. Everything is ok except one problem.
the node's field label can not be set in the Manage display panel. And the node's body label was disappeared,and other's labels do exist but can not ,say, be set hidden ,above,inline.
I google the for solutions but bad luck no result.
Need your Help. Thanks.
I do not get the point in modifying the php file to do what you want. I think you just want to set a two-column layout, but you do not need to edit your code to do so. Have you tried the Display Suite module?

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.

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