Drupal 7 custom page templates




















You now will see a blank node create form. Fill in a Title, choose your Date, and fill in some Overview Text. Next, choose an address for your event, and once it's filled in, click the Geocode this address button, and your little map below will re-center itself on your address. Figure 10 shows the final themed layout. There's so much more you can do with custom content types and theming in Drupal 7; this is just the tip of the iceberg.

If you want to get more hands-on with code, you could dispense with Display Suite and add a node--event. Web Development. Drupal 7: It's All about Fields When you customize content in Drupal 7, it involves creating or modifying what's often referred to as a content type. Theming and Nodes A Drupal 7 Node is simply an individual page with content that's rendered using a specific content type that contains all of your fields.

Figure 1. Drupal 7 Administrator Toolbar On the content type landing page, as shown in Figure 2, you can see existing types, and you would add new ones here. Tools Needed Now that you have a basic overview of how content types work, let me show you how to build a new one and theme it. Mock It Up When creating a new content type, I like to do a quick mock-up to get a better picture of how I want the finished product to look. Figure 4. Mock-up of how an Event page will look.

Essential Modules The mock-up helps determine which modules I'll use. In the Format string text box, copy and paste or type in this string: l F j, Y- g:i a T You will see that it immediately renders as a nicely formatted date like this: Sunday August 12, am PDT Let's give this new format a name.

Create an Image Style For the event image, you'll want a custom style. You can pretty much accept the defaults here, but let's customize a little: Name: Event. Description: a custom content to display company events. Publishing Options: uncheck Promoted to front page. Display Settings: uncheck Display author and date information. Comment Settings: set to Hidden under Default comments setting for new content.

Menu settings: uncheck Main Menu. Figure 6. Type — Date ISO format. Widget — Pop-up calendar. Click Save. Now on Field Settings, accept the defaults and save again. On the next screen, check Required Field.

Click on More Settings and Values. Now for Date Entry Options, choose a format from the select list. Type — Geolocations Fields. Widget — Geocoder.

Save, and on the next screen for Search options, choose No Search box. Save, and on the next screen, check Required field. Accept all other defaults here, and save again. Type — Link. Widget — Link. Save, and on the next screen, simply save again.

On the next screen, make required and choose Required Title, and save. Type — Image. Widget — Image. Save, accept defaults, and save again. On the next screen, check Required field. Check the Alt and Title fields, and save. Manage Your Display Now you just need to do a little theming using the Manage Display tab for your Event content type.

Figure 8. Figure 9. Figure The Final Themed Layout for the Event Content Type There's so much more you can do with custom content types and theming in Drupal 7; this is just the tip of the iceberg. Recent Articles. Improve this answer. For URL like myrally. DigitalPixies DigitalPixies 1 2 2 bronze badges. Sign up or log in Sign up using Google.

Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Helping communities build their own LTE networks. Podcast Making Agile work for data science. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Winter Bash There is a node. On top of that, themes like Zen add this type of override to the Template Suggestions, which leads those using Zen to believe that this is part of the default list.

Check the theme documentation to see if this override has been added to the Template Suggestions by the theme. The process is straightforward. Open the template. If this function already exists, you will need to add the if statement to the end of the function just before the closing bracket.



0コメント

  • 1000 / 1000