Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds

How-To Tutorials - CMS & E-Commerce

830 Articles
article-image-increase-website-traffic-free
Packt
19 Mar 2010
5 min read
Save for later

Increase Website Traffic for FREE

Packt
19 Mar 2010
5 min read
Increase Website Traffic for FREE There are many techniques to getting more visitors to your website or blog. Here are a few of the better ways of getting more visitors to your website. Oh, and they're all free and you should be able to implement most in just a few minutes. Firstly, some things to keep in mind as you read these tips and tricks for getting more, free, website visitors... Google looks at your website and tries to think how a human would think.If a real person would rate your website highly, then so will Google. Google reads the words on your website.Phrases that you want to get found with should at least appear somewhere on your website. A real person would rank more highly a website with lots of links to it. If lots of other people link to the site then it must be popular.Google ‘thinks’ in exactly the same way using a technique called Page Rank or PR. More on this later. Content that changes is more interesting for repeat visitors,and Google rates more highly websites that change frequently for this exact reason. OK, with these key ideas in mind, lets move on to sending more people to your website. Who knows, the increase in website traffic may increase inquiries, orders and profit! Change your writing style As an example, take the last sentence from the previous paragraph. It used to read like this... OK, with these key ideas in mind, lets move on... This sentence would be OK in the real world, but it contains no words of any importance or relevance to our topic. The sentence was edited to contain pertinent words relating to increasing website traffic and now reads like this... OK, with these key ideas in mind, lets move on to sending more people to your website. Who knows, the increase in website traffic may increase inquiries, orders and profit! Look at every sentence on your website. Does it stand up on its own? Cut out the clutter and add key words and phrases. If you sell cars, avoid impotent phrases like "Customer Service to Rely On" and use phrases such as "Discount Car Dealership, Midlands UK". Potential visitors searching on Google won't be searching for "customer service", but they will be searching for "car dealership, midlands". Another small tip relating to your writing style is to use all derivatives of words. Take for example the car dealership. Visitors searching Google might type "dealership" or they might type "dealer". Try to use both in your text to appear in as many search results as possible.Get Inbound Links Links to your website from others offer two great benefits. Visitors to the other sites might see the link to your site and pay your site a visit. Your website Page Rank will be increased as your site now looks more popular. One of my favourite websites for blagging a free link from is www.pagemost.com. Fill in the small form on the home page and they build a page for you based on your location (give a false postcode if you're not location based). This free page is built to do well on search engines and includes a link back to your website. www.pagemost.com has a Page Rank of 5 at the time of writing, which is well worth getting a link from. To get your free page found, www.pagemost.com do recommend that you link to it from your own page, otherwise the search engines won't know it exists. On this note it's worth mentioning that although you want to get as many inbound links as you can, you should also avoid adding too many outbound links. Ebay How can Ebay help increase traffic to your website? Ebay is a very popular website and links from it to your own website will make your site look more popular. By ensuring that you always have auctions on the go at Ebay, you will always have links to your own website. It doesn't matter what you are selling as long as you remember to add links to your own website from each auction. Wikipedia It's not relevant to all websites, but why not give your website a mention and a link in Wikipedia. Most pages in Wikipedia have links to external sites, so why not add yours! If you are blatantly spamming then be prepared to be removed straight away, so make sure your website is related to the topic in question. Home Page Re-write a portion of your home page every month. Adding news items is a great way to force you to do this and gives you a reason to change the page monthly. And don't forget, a website with out of date news items looks as though the company has gone bust, so once you start this technique for generating website traffic it is most definitely an on-going process. Conclusion Re-write your website content or get somebody to do this for you. Include good words and phrases and cut out the dross! Get links to your site from sites like www.pagemost.com Get some auctions underway on Ebay See if any pages in Wikipedia or similar will handle a link to your site  
Read more
  • 0
  • 0
  • 1371

article-image-cms-made-simple-16-getting-started-e-commerce-website
Packt
19 Mar 2010
10 min read
Save for later

CMS Made Simple 1.6: Getting Started with an E-commerce Website

Packt
19 Mar 2010
10 min read
With the Products module, you can manage: Products Product attributes that will have an impact on the price (like size or color) Categories Product hierarchy Custom fields This module is the basis for all other modules that you will use later on. After all, you cannot start a shop if you do not have any place to store the products. Install the Products module with the Module Manager. Pay attention to the Dependencies section of the module before installing it. There are two (CGExtensions and CGSimpleSmarty) modules that provide convenience APIs, reusable forms, and Smarty tags for use in other modules. If you are not a programmer, you probably will not need to do anything with these modules besides adjusting some preferences if you ever need them. In the workshop described here, you just need to install them. Time for action – adding the first product After the Products module is installed, we will display it on the page Shop and add the first product to it as follows: Create a new content page Shop (Content | Pages | Add New Content). Add the Smarty tag {Products} into the field Content of the page. If you see the page in browser, it will not show anything at this time as you have not added any product to the shop so far. In the admin console of CMS Made Simple, click on Content | Product Manager. Under the Products tab, click on the Add A Product link and add your product as shown in the following screenshot: Click on Submit and see the Shop page on your website. What just happened? You have added the first product to the Products module. This product is displayed on the page with the Price and Weight (we can delete this field later on). Click the product link to see the detailed view of the product. The template looks very technical, but with some HTML, CSS, and Smarty knowledge you can change its look and feel later on. Let's concentrate on the functionality of the module first and not on the design. Add some more products in the Product Manager and see the list of products on the Shop page. Pay attention that the detailed view of every product is displayed in the same way. In the Products module, there are some fields like Price and Weight already defined. But you will need to add your own fields. Creating custom fields Usually one or more pictures of the product can be found in an online shop. However, there is no special image field where you can upload the product picture. Luckily, you can add as many custom fields as you need. In the next step, you will create a custom field, where the image of the product can be uploaded. In the admin area of the Product Manager, choose the tab Field Definitions and click on the link Add A Field. Name is a kind of technical field that is not displayed to your visitors. You should not use any special characters or spaces in the name of the field. Use only letters and numbers, no dashes, slashes, or anything else non-alphanumeric. The Prompt field is the label of the field that you will see in the admin area of the Product Manager during adding or editing products. You can use any characters in this field. The Type of the field should be Image. By selecting this type you ensure that the field is displayed as a field for file uploads in the admin area. This field will also be validated, so that only images can be uploaded here. Additionally, thumbnails for the uploaded images (small preview versions) will be created automatically after upload. Let the field be public by selecting the checkbox for Is this a public field? It means that the content of the field (the image itself) will be shown to the visitors of your shop. If you make it private, only the administrator of the website can see the field in the admin area of the module. Save the field. This field is automatically added to the detail template on the page and the editing view of the product in the admin area of the Product Manager. To test the field, open any product for editing in the admin area, and the field Product image (Prompt), and upload an image for the product using this field. Control the display of the field in the detailed view of the product on the website. The small preview version of the product is added to the section Custom Fields of the detailed view. We still do not care of how it looks like, but how it works. We will change the detailed view of the product when we are ready with all the custom fields and the product hierarchy. Image already exists When you try to upload the same image twice you will get an error saying that the image has been already uploaded. To control what images are already saved for the product and delete them, open Content | File Manager in the admin console. Find the folder Products and then the folder name product_[ID]. The ID of the product is displayed in the list of products in the admin area. Click on this folder and remove the images already uploaded. Now, you can upload the same image in the admin area of the Product Manager. Define your own fields Create as many custom fields as you need to display and manage the product. With the Type of the field you decide how the field is displayed in the admin area. The output of the field on the page can be fully customized and does not depend on the type. If you need a Product Number field, create a new custom field (Text Input) with maximum length of 12 characters and make the field public. Then edit each of your products and enter a number in this field. You can adjust the order of the fields under the Field Definitions tab. Again, this order only applies to how the admin area for the product management looks; the output on the page can be completely different. Creating a product hierarchy Next, let us create a product hierarchy. In the official shop that I am trying to reproduce here, there are four hierarchy items: Shirts (short) Shirts (long) Home & Office Mugs You should understand the difference between product categories and product items in the Product Manager module. Product categories are kind of tags for the products. It is not possible to arrange them in the hierarchy. However, you can assign one product to multiple categories if you like. In contrast to the categories, a product can belong to only one hierarchy item. That means the structure above should be implemented as a hierarchy and not as categories. One product cannot be a shirt and a mug at the same time. We will use categories later on to mark the products as: New Popular Discounted Categories will allow you to make one product both new and discounted at the same time. A hierarchy would not, as multiple assignment is not possible. In the admin area of Product Manager, click on the Product Hierarchy tab and create four hierarchy items displayed in the first list. It is your choice if you want to add any description or image to the hierarchy or leave it empty. Once the hierarchy is created, go through your already created products and assign them to the proper hierarchy item. The hierarchy can now be displayed in the sidebar navigation on the page. Open the main page template (Layout | Templates) and find the section with sidebar navigation. Add the Smarty tag for the product hierarchy shown as follows: {Products action="hierarchy"} Customizing product templates The display of the product hierarchy template is very technical. Let's customize all the templates for the module. There are three of them: Summary Templates Detail Templates Hierarchy Report Templates Let's start with  the Hierarchy Report Templates. This template defines how the hierarchy in the sidebar is displayed. In the admin area of the Product Manager, click on the Hierarchy Report Templates tab and find the list of existing templates for the hierarchy. The template Sample is the one that is used by default. You can customize this template or create your own by clicking on the New Template link. I choose the second way. It is generally advisable not to change sample templates, but create your own and set them as default. This way you can delete anything from the custom template and use the Sample template for reference if you need parts removed from the custom template. For the template name, I chose My Shop. However, you can use any name you wish. In the Template Text field, the sample template code is already suggested. Leave this code as it is and submit the new template. Now you see two templates in the list. Make the template My Shop the default one by clicking on the red cross in the Default column. Let's see what we have in the template and what we actually need. Open the new template for editing: Smarty variable Description {$hierarchy_item.name} The name of the hierarchy item {$hierarchy_item.id} The ID of the hierarchy item {$upurl} The URL to the parent hierarchy item. Only applicable if there are more than one hierarchy level. {$mod} The object containing all the information about the module Products. In the template the object is used to get translations: {$mod->Lang('parent')} returns the translation for the key parent from the translation file. You can replace this variable with your custom text if your website is monolingual and the language of the website will never be changed. {$parent} This array supposes to hold the information about the parent item. However, it is not assigned in the current version of the module and cannot be used. {$child_nodes} The array that contains information about all child hierarchy items. The information from this array: {$child_nodes.id} - ID of the hierarchy item {$child_nodes.name} - name of the hierarchy item {$child_nodes.description} - description of the hierarchy item {$child_nodes.parent_id} - ID of the parent hierarchy item {$child_nodes. image } - the name of the image file for the hierarchy item {$child_nodes. thumbnail} - the name of the thumbnail file for the hierarchy item {$child_nodes. long_name} - the full name of the hierarchy item (including the names of all parents) {$child_nodes. extra1} - the value saved in the Extra Field 1 {$child_nodes. extra2} - the value saved in the Extra Field 2 {$child_nodes. downurl} - the URL for this hierarchy item {$hierarchy_image_location} Path to the folder where images for the product are saved. {$hierarchy_item} An array that contains the id of the actual item hierarchy.
Read more
  • 0
  • 0
  • 1975

article-image-alfresco-web-content-management-wcm-20-part-one
Packt
19 Mar 2010
9 min read
Save for later

Alfresco Web Content Management (WCM) 2.0 Part One

Packt
19 Mar 2010
9 min read
Web Content Management (WCM) Modern web site implementations are architected with two distinct sets of capabilities – creation and maintenance of the content and delivery of the content to the target audiences. Creation and maintenance of web content is called Web Content Management (WCM) and is a relatively new discipline in the history of web technology.   In the early days, web sites were simple with static content that changed infrequently. Modification of the content was not the biggest of challenges and such changes were typically performed by technical developers. Web technology and the associated disciplines have come a long way since those times. Today there are well-defined disciplines involved in creation of web presence such as information architecture, visual design, content strategy, and site development. Products of these disciplines are merged together and realized through enterprise application technology, which adds functionality and dynamic nature to web sites. Specialization of roles among these disciplines as well as the complexity of the modern technology has made content updates difficult and error prone when performed directly on stored content. A WCM system makes it easier to create and update content by hiding the technical details related to the storage and delivery of content. It becomes almost imperative to use a WCM system for sites that have highly dynamic content which may also need to be delivered on multiple channels such as web, handheld devices, and print media. In such situations, content can be created once and rendered automatically for different channels. The WCM products available today vary widely in terms of their capabilities, the underlying technologies and frameworks, and the extent to which they use open-source products as architecture components. Many WCM systems also offer presentation capabilities in order to facilitate delivery of content at least for the web medium. When discussing WCM features, it is useful to identify what WCM is and what it isn’t. WCM deals with creation, persistence, and maintenance of content. It may also include some support for presentation in terms of previewing the content being created or edited. However, fully-featured presentation frameworks or technologies, such as portals, should be evaluated separately, since majority of their concerns are significantly different. Products with integrated WCM and portal capabilities offer the convenience of a one-stop solution for building, managing, and delivering web content. On the other hand, products with only WCM capabilities, or at least clearly separable WCM capabilities, offer freedom to use rich and mature presentation technologies which may already be in place in the existing infrastructure. Let’s take a look at a few products, which represent various points along the spectrum between these two extremes. Microsoft SharePoint Server is a well-known product with a wide range of content management capabilities that go beyond WCM and portals. Similarly, EMC Documentum is a high-end platform for enterprise content management which can be used in almost any way enterprise content may be intended to be used. EMC Documentum provides products catering to specialized needs – Web Publisher for creating and managing web content, Site Caching Services for pushing content to Web or Application Servers, and integration options with portals for presenting content. Interwoven and Vignette also offer high-end WCM systems. There is also a wide range of open-source options for WCM which have developed large user bases. Joomla! (as well as Mambo, where Joomla!’s origins lie) offers an integrated WCM and portal technology built on the LAMP (Linux, Apache, MySQL, PHP) platform. Joomla! offers over 100 components for providing specific optional capabilities such as building user communities or incorporating shopping carts. Joomla! makes it very easy to set up a web site in minutes if you are willing to work with its content organization and presentation model. Alfresco is an open-source platform developed with the stated goal of bringing enterprise content management (ECM) capabilities to open source. The Alfresco leadership team brings content management experience from companies such as Documentum, Business Objects, and SeeBeyond. Alfresco has matured with two major releases over a period of 2.5 years. Alfresco enables Document Management, Collaboration, Records Management, Knowledge Management, Web Content Management and Imaging – some of the most common applications of enterprise content management. Alfresco WCM 2.0 was released recently and offers some exciting built-in features that promote development efficiency and reduce infrastructure demands. We will explore these aspects in this article.   WCM Challenges Every WCM system is expected to provide certain fundamental features. The core WCM feature is the ability to edit content through a user-friendly and technology-neutral (as much as possible) interface. The system also needs to provide security and the capability to allow a team to work on the content. WCM systems typically support versioning for content items. Finally, the content needs to be exported to a form suitable for web or application servers for delivering to the target audiences. There are certain other features that are not necessarily required in a WCM system, but are considered to be desirable and are supported by many contemporary WCM products. One such feature is the ability to store content in XML format. XML content facilitates publishing the same content through multiple channels such as web, wireless devices, and print media. Another common and desirable feature is the support for business processes or workflows. At the minimum a simple approval process is desired which can be used to review and approve the promotion of content changes to a live environment. The WCM features discussed so far focus on what a WCM system can do. However, some of the challenges for WCM initiatives deal with how a WCM system supports certain capabilities. Such aspects may significantly affect development efficiency, quality assurance, and infrastructure costs. We take a look at some of these concerns below. Simple static HTML pages seem to belong to a bygone era. Even simple web sites today are usually dynamic and frequently contain media (images, videos) and utilize code and a database. Today, web site management deals with managing content, media, and code together. As a result, the line separating a web application from a web site is a blur. Note that sometimes the term “content” is used to refer to all the resources managed by a CMS. For sites utilizing code and media along with plain content, it becomes important that all of these resources are managed in sync. For example, if a change is made to include a new user attribute in the user profile the corresponding code or configuration changes need to make it to the live environment, along with any presentation changes (web pages that will use this new attribute). These requirements become more complex when you consider the fact that different team members may be working on related artefacts and these changes need to go through the review process concurrently. Another aspect of managing dynamic web sites is that often multiple web pages need to change to reflect one feature change in the web site. For the example above, the new user attribute may require a change to the user registration screen, user profile screen, and possibly some site functionality that utilizes the given feature. Thus, adding an email format preference to the user profile may require changes to three pages, two code components, and one configuration file. These affected artefacts together form a change set – they all need to go into the web site together or none of them should. If one or more pieces in the change set were left out, the change would not function as expected and would likely introduce a bug. Change sets bear some similarity to transactions and versions. The description above reflects the similarity to a transaction since all the changes should either be committed or discarded together. On the other hand, suppose a change set implementing a particular feature was promoted to the live environment. It worked as designed and expected. However, it led to unexpected business impacts and now this change needs to be undone. The WCM system should make it easy to roll back the changes introduced by a change set. If the system kept track of web site snapshots – state of the complete site after each change set was promoted, it would be simpler to go back to a prior state of the web site. One of the trickier challenges of WCM systems is to provide multiple environments which are isolated but more or less similar in structure. For example, each developer requires an area where he/she can make changes without impacting other developers or to the live environment. However, each developer should only see his/her changes on top of the currently live content. Then multiple change sets might need to be reviewed by different reviewers concurrently. Each reviewer should only see the change set to be reviewed on top of the currently approved content. Thus, there is a need for an on-demand virtual copy of the web site which includes the approved content and a change set. Such an isolated environment is commonly referred to as a sandbox. In the rest of this article, we will explore the core features offered by Alfresco WCM 2.0 and how it addresses the WCM challenges described above.   Alfresco WCM 2.0 Alfresco is an open-source content management platform. Alfresco WCM 2.0 is an optional add-on which can be installed on top of the core platform to enable WCM capabilities. In this section, we will look at typical usage of Alfresco WCM 2.0 and highlight how it handles the challenges described earlier. Alfresco organizes storage in spaces. A space is a smart folder which can be associated with configurable rules. These rules control what happens to documents or other spaces that are added under the space. Among other things, these rules enable workflows within the platform, support automatic versioning, and automatic rendition generation.   Installing Alfresco WCM 2.0 adds two spaces to the repository – Web Projects and Web Forms, as shown below in the Alfresco standard web interface. The Web Projects space holds other spaces, where each space represents one web site. The Web Forms space holds templates for creating and publishing content for different content types such as a press release or a company profile.                           Two Spaces are Added by Alfresco WCM 2.0 Web content for a site is managed under a web project space which is created under Web Projects. For example, the following screenshot shows alfrescowww as a space created for managing content for this web site. A Space for Holding Content for a Web Site Continue reading Alfresco Web Content Management (WCM) 2.0 Part Two [ 1 | 2 ] Read Alfresco Web Content Management (WCM) 2.0 Part OneRead Alfresco Web Content Management (WCM) 2.0 Part Two
Read more
  • 0
  • 0
  • 2130
Visually different images

article-image-roles-alfresco-14
Packt
19 Mar 2010
9 min read
Save for later

Roles In Alfresco 1.4

Packt
19 Mar 2010
9 min read
Roles in Alfresco 1.4   The article explains the basics involved in understanding Alfresco authorization and the means to extend its functionality, for example, to adapt it for any special requirements through configuration files. The concepts explained in the article will be useful for anyone who has started working with Alfresco code. In addition to this, a little step-by-step example towards the end helps you extend the initial Alfresco roles. Read out more in the article written by Alfonso Martin. Once you have started with Alfresco, you will realize that you need to create or expand the default roles included with Alfresco. This task (at this moment) must be done manually through configuration files. Before diving into the Alfresco.war file to search for the property configuration files, you will need to understand a few concepts. This article will introduce you to the basics in Alfresco's role policy. The basic concept in action authorization in Alfresco is that of permission. Permissions dictate when an action can be executed on an object by a user. Key concepts in defining authorization policy in Alfresco are: PermissionSets PermissionGroups Permissions GlobalPermissions Such elements are declared in the permissionDefinitions.xml file, located in WEB‑INF/classes/alfresco/model inside the Alfresco.war file. PermissionSet Collections of permission groups, permissions, and dynamic authorities with common attributes: type: (Mandatory) PermissionSet is defined over a type or aspect. If it is defined over a type, then it is applicable for all objects of that type; if it is defined over an aspect, then it is applicable for all objects that have the same aspect. expose: (Optional) This attribute restricts the domain of Type. If the value is all, it is allowed to apply a PermissionSet to objects, which have a parent that satisfies the Type attribute. Otherwise, if the value is selected, the set is only applied to objects that satisfy Type attribute. All is assumed, if the attribute is undefined. PermissionGroup PermissionGroup defines its behaviour through several attributes: name: (Mandatory) Group identifier. type: (Optional) Same as in permissionSet. extends: Determines if the permissionGroup extends the definition of a previous group with the same name. If undefined, default value is false. expose: Restricts the domain of type, and if true, the permissionGroup will be applied to objects (and derivatives) that satisfy the attribute type. If it is undefined, then false is assumed. allowFullControl: If true, group has all privileges, else the privileges are to be assigned. requiresType: If false, permissionGroup can be applied to any object, otherwise only to objects that satisfies type. If undefined, the default value is true. PermissionGroup can be composed by several permissionGroups, whose sub groups will be identified by name and type. If type is omitted, the parent’s type will be used. Permission A permission is the minimal unit to represent an authorization of an action on an object. It is defined by: name: Permission identifier expose: If true, the permission can be applied to derivative objects, otherwise only to objects defined in a permissionGroup context. Default value is false requiresType: If true, a permission can only be applied to objects defined by its group context. If it is omitted, default is false A permission can require the authorization of other permissions, such permissions are identified by: name type on: Specifies where the permission is required—node, parent, or children. implies: If true, the required permission grants itself the parent’s permission. There can be only one required permission with attribute implies equal to true. If omitted, the default value is false. Inside the permission are the declarations of the permissionGroups that contain said permission. These declarations require existent permissionGroups, and can optionally specify the node types where the permission will be applied will be applied to all nodes. GlobalPermission These kinds of permissions are defined outside a permissionSet, and are applied to all nodes in the hierarchy (irrespective of its type and related aspects). This kind of permission prevails over other permission types. Roles Roles in Alfresco are a special type of permission group, concretely permissionGroups, which are defined in permissionSets applied to nodes of type content. To use these roles in the Alfresco GUI, it is necessary to create appropriate tags in the internationalization files, more specifically, the webclient.properties (this file can vary in function of language/country) and is typically located in WEB‑INF/classes/alfresco/messages Predefined Roles Alfresco defines a few basic roles in the permissionDefinitions.xml. These roles are defined in an incremental manner. First, it creates a Consumer role and then defines the rest of the roles, adding functionality to the Consumer role. Predefined roles are: Consumer: Allows read properties, content, and children of a node. Editor: Adds to consumer privileges the ability to write nodes (properties, content, and children) and execute CheckOuts in nodes with aspect lockable. Contributor: Adds to consumer privileges the possibility of adding children and execute CheckOuts in nodes with aspect lockable. Collaborator: This role has the same capabilities as Contributor and Editor. Coordinator: This role has all privileges including the possibility of taking ownership of nodes, and changing its owner. Administrator: Same as Coordinator, it is defined for backward compatibility. Default Permission Policy After a first check out of the permissionDefinitions.xml file in Alfresco 1.4, you will find five major PermissionSets. These sets establish node permissions across the Content Model hierarchy: It starts with base type, which defines basic low-level permissions. The next set defines permissions for the cmobject node types, which at this level are defined in the permissionGroups and later will be extended by roles. Content nodes have a set, which defines the available roles. In addition to these sets, the permissionDefinitions.xml file includes two other sets. One of these sets is for nodes that have the aspect ownable, and the other is for nodes that have the aspect lockable. The permissions defined in such sets allow the execution of typical specialised actions with these kinds of nodes—Check In, Check Out, Take Ownerships, Change owner, Lock, and Unlock. After PermissionSets, the configuration file declares GlobalPermissions. These permissions will be applied to all nodes, and they have priority over other permission types. At the moment, these permissions are: FullControl: Allows users who have any of these roles—ROLE_ADMINISTRATOR or ROLE_OWNER. Unlock, CheckIn and CancelCheckOut: All these allow users who have their role defined as ROLE_LOCK_OWNER New role definition example: This example is based on ideas explained in one of the Alfresco forums. The case study is the typical context, where three specialized folders are needed—Drafts, Pending approval and Published. Drafts: Stores actual working documents. Pending approval: This folder contains documents whose author(s) has/have requested approbation. Published: Stores final versions of documents. Preconditions There exist two differentiated user groups—Creators and Approvers. Creators have full access to folder Drafts and read access in Published; Approvers have full access to Pending approval and Published. Creators need to move documents from Drafts to Pending approval, but cannot see the folder files. To model this situation, we create two user groups called Creators and Approvers. Then create three spaces Drafts, Pending approval and Published. Each space will have the following configuration: Drafts: Uncheck Inherit Parent Space Permissions checkbox. Invite group Creators with role Collaborator. Pending approval: Uncheck Inherit Parent Space Permissions checkbox. Invite group Approvers with role Coordinator. Published: Uncheck Inherit Parent Space Permissions checkbox. Invite group Approvers with role Coordinator. But as you can see, with this configuration there exists a situation with the prerequisite: Creators need to move documents from Drafts to Pending approval, but cannot see the folder or files. Alfresco does not include any role that satisfies this. So, it lets you create it. Open the permissionDefinitions.xml file. First define a low level permissionGroup called CreateNodes, this group should be defined inside permissionSet with type base; in other words, available for all kinds of nodes. Also inside this set we need to declare the permissions that compose this permission group: In our case only the permission _CreateNodes. ...   <permissionSet type="sys:base" expose="all"> .../p>   <permissionGroup name="CreateNodes" expose="true"   allowFullControl="false"/> ...   <permission name="_CreateChildren" expose="false">     <grantedToGroup permissionGroup="CreateChildren"/>     <grantedToGroup permissionGroup="CreateNodes"/> <!-- New -->   </permission> ...   <permissionSet/> Then we need to define a role called Writer (remember, in set with type content), this role extends the behavior of a permission role declared in the set with type cmobject. The permissionGroup, Writer will include previously defined CreatedNode. ...   <permissionSet type="cm:cmobject" expose="selected"> ...     <permissionGroup name="Writer" allowFullControl="false"                                                        expose="true">       <includePermissionGroup type="sys:base"                                       permissionGroup="CreateNodes"/>     </permissionGroup> ...     <permissionSet/>   <permissionSet type="cm:content" expose="selected"> ...     <permissionGroup name="Writer" extends="true" expose="true"/> ... With these additions, we have created a new role called Writer that will solve our little situation. To be allowed to use it in the Alfresco GUI we need only to add a properly internationalization tag in webclient.properties: Writer=Writer role [...] Writer= OurWriter role And now we can invite the Creators group to the Pending approval space with the Writer role. The creators will be able to move documents from Drafts to Pending approval, but they will not be able to read the folder. The last operation is to add a rule called Request approval in the space Drafts that moves documents from Drafts to the space Pending approval. This is a trivial example for homework where you can try to add rules  in spaces with simple workflows to formalize the process  of  approbations and rejections.
Read more
  • 0
  • 0
  • 1606

article-image-alfresco-web-content-management-wcm-20-part-two
Packt
19 Mar 2010
6 min read
Save for later

Alfresco Web Content Management (WCM) 2.0 Part Two

Packt
19 Mar 2010
6 min read
The Web Forms space holds forms that define content templates. For example, we may want press release to be a content type for the web site. A press release may contain a title, an abstract, a location, and several paragraphs in the body. These content elements can be defined in an XML schema file. Alfresco WCM uses the information in the schema file to automatically create a form which can be used for creating XML content for press releases. Once this content is created it can be published to multiple channels –web site, plain text, and wireless devices such as cell phones, for example. The publishing conversion for each channel can be defined using transformations which are specified using XSL, among other options. Content templates can be shared across multiple web sites. The following figure illustrates how a content item for a content type is created and published for multiple channels. Creating Content and Publishing on Multiple Channels for One Content Type Once the space for web site and the web forms (content templates) have been set up, we need to set up users with appropriate content development roles. For example, different users may play roles such as Content Publisher, Content Reviewer, and Content Manager in the content creation process. Further, a Web Developer role may perform the necessary setup needed prior to content creation. Alfresco supports the concepts of change set and sandbox described earlier. Each user gets a separate sandbox, which is an isolated view of the web site. Each user’s sandbox shows only that user’s changes on top of the existing approved content. Similarly, when a user needs to approve a set of changes only those changes need to be visible on top of the approved content. A change set is a set of changes that move together in a workflow. The following screenshot shows user sandboxes and the staging sandbox which contains the currently approved content. The Modified Items link shows the content items the user is currently working on. Staging and User Sandboxes Note how each of the sandboxes allows a separate preview of the website incorporating the changes present in that sandbox. The preview of staging sandbox consists of only the approved content. Alfresco WCM 2.0 includes a virtualization mechanism for supporting in-context web site previews. For example, the following screen shows a preview of the Staging Sandbox web site. Note that there is one approved press release. A Published Press Release in Preview Another, very useful feature of Alfresco WCM 2.0 is snapshots. A snapshot captures the complete state of the web site at a given point in time – it can also be thought of as a version of the web site. Alfresco allows reverting back to an older snapshot with just one click. The figure below shows how easy it is to revert to an older snapshot – version 8 was created by clicking on Revert in the row for version 4.   Reverting to a Prior Web Site Snapshot In version 4, the news story shown earlier had not been approved. Previewing the web site for Staging Sandbox now shows no press release in the screenshot below. Previewing the Staging Sandbox after Reverting to an Old Snapshot Note that security and workflow capabilities are part of the core Alfresco platform and are utilized by WCM 2.0. The features discussed above focus on the core development process where content is created via web forms and goes through the approval process, allowing site preview at every point. However, Alfresco WCM 2.0 architecture is versatile enough to allow content creation through standard interfaces such as WebDAV and CIFS (Common Internet File System). Further, it allows content delivery to multiple sites and supports multiple web application technologies. The following figure illustrates these capabilities of the Alfresco architecture. Source: Alfresco WCM Webinar, March 2007 Note that the terms Dev, Preview and Live in the figure above represent the creation of code, content, and media and their movement through the approval process. The Alfresco server shown in the middle is one production environment. In reality, you would need one or two additional environments for performing configurations and customizations in a separate environment which will not accidentally bring your production system down. For example, you should rehearse the space structure setup, security setup, custom rules and configurations in a development environment. Ideally, you would replicate the setup in a QA environment where the configurations/customizations can be tested before applying to the production environment. The development environment remains the playground for trying out any new configuration or customization. The environment concerns described above are not unique for Alfresco WCM 2.0 – there are fairly similar concerns in other WCM systems. What is really pleasant about Alfresco is that it is lightweight enough to run on a single physical machine for dev and QA purposes. On the other hand, production can be set up in truly sophisticated configurations to handle performance, availability, and disaster recovery requirements. Further, Alfresco’s ability to use various commercial components (database, application servers, etc.) as well as popular robust open-source alternatives liberates customers by giving them back the power and freedom to choose what is best for their technical environment.   Conclusion Web Content Management is one of the most popular applications of Enterprise Content Management. There is a wide range of WCM products available in a spectrum ranging from open-source products to completely proprietary offerings. Alfresco WCM 2.0 is a recent release which makes secure content management in a team environment a breeze. It offers exciting features which enable content managers to review, approve, and roll back business or application-level features. This is a huge improvement over managing content, media, and code at an individual file level. The Alfresco WCM 2.0 architecture takes the pain out of adding content from various sources as well as delivering content to multiple channels. The underlying Alfresco architecture puts the power and freedom of choice back in the customer’s hands by liberating them from vendor lock-in. By building upon robust open-source technologies Alfresco leaves more cash in the customers’ pockets for completing their strategic content management initiatives successfully.   References and Resources   Alfresco 2.0 Web Content Management Product Evaluation Guide Book – Alfresco Enterprise Content Management Implementation Alfresco WCM Webinar, March 2007 Alfresco 2.0.1 and 2.1.0 Update Alfresco.com
Read more
  • 0
  • 0
  • 1232

article-image-shipping-taxes-and-processing-orders-wordpress-29-ecommerce
Packt
18 Mar 2010
4 min read
Save for later

Shipping, Taxes, and Processing Orders with WordPress 2.9 eCommerce

Packt
18 Mar 2010
4 min read
  Locations and tax setup There's no doubt that tax law is complicated, but it's a necessity. It's far beyond the scope to discuss tax law in all countries, so be sure to do your own research regarding taxes for your own state, country, and region. For businesses located in the USA, here are a couple of links to get you started: Amazon Sales Tax Info – http://bit.ly/amazon-sales-tax State Tax Info – http://www.business.gov/finance/taxes/state.html Within the USA, most businesses charge state sales tax based on the shipping information that the customer provides. While nine times out of ten a customer's billing and shipping information are the same, the times when the billing and shipping information differ can lead to some interesting scenarios. For example, if your store is based in Kansas, a customer in Kansas who buys a product and ships it to Texas would not have to pay tax on that order at least not to the state of Kansas. On the other hand, a customer in Georgia who buys your product and ships it to Kansas would have to pay tax on the order. Again, tax law is undoubtedly complicated, so be sure to look up any laws specific to your own state. On to business—the first thing to do is to verify that your Base Country/Region is correct. You can find this under the General tab of the WP e-Commerce Plugin Settings, as seen in the following screenshot: Next, verify that the tax percentages are correct for your state or region. This is just underneath the settings for Base Country/Region. Finally, switch to the Checkout tab at the top to consider one more setting. Just, under Checkout Options there is an option to Lock Tax to Billing Country. This is shown in the following screenshot: What this option does, once selected, is lock the billing country to the shipping country. For stores in the USA, it also has the effect of locking the billing state to the shipping state. This certainly simplifies matters, but it doesn't quite solve the tax scenarios outlined earlier in this section. Shipping Options and Calculators Configuring a store's shipping options is potentially one of the most complicated tasks that new store owners face, but it doesn't have to be. Much of it depends on the type of products that you are planning to sell. The absolute simplest scenario involves selling digital downloads only, in which case you don't need to worry about shipping at all. When dealing with tangible goods, one's shipping needs grow increasingly complicated depending on the diversity of the products involved and anticipated location of the customers. For instance, selling books as well as clothing will create different shipping needs than selling only books or clothing. Also, planning to sell to customers worldwide will necessitate more complicated shipping needs than limiting one's customer base to only one or two countries. Unlike creating and modifying a product catalog, configuring shipping settings is a task that only needs to be done once. General Shipping Settings To view and modify your shipping settings, switch to the Shipping tab at the top of the Settings page, as seen in the following screenshot: Under the General Settings, you have the option to globally enable or disable shipping. If your shop is comprised of digital downloads only, then you can safely switch the Use Shipping option to No and rejoice! You no longer have to worry about any shipping confi guration. The following screenshot shows the relevant panel: Those, who do sell tangible items should leave it set to Yes, as shown above. If your store is located in the USA, add the Zipcode for the area from where you will be shipping items. This is really only necessary if you plan to use one of the external shipping calculators (UPS or USPS), but it doesn't hurt to add it anyway. If you subscribe to the third-party Shipwire order fulfillment service (www.shipwire.com), set the Shipwire option to Yes and enter your relevant login information. Shipwire is a service that collects and stores your products for you, shipping them to customers when necessary. While convenient, Shipwire comes with a cost, currently starting at $30 per month. One neat aspect of the e-Commerce plugin is that you can opt to allow for free shipping, provided that the order price is above a certain threshold. At the bottom of the general shipping options is a toggle to Enable Free Shipping Discount, as seen in the following screenshot: Enter a threshold amount of your choice, such as $50, like seen above. Any orders that customers place with a value equal to or higher than that price will automatically qualify for free shipping.
Read more
  • 0
  • 0
  • 1295
Unlock access to the largest independent learning library in Tech for FREE!
Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
Renews at €14.99/month. Cancel anytime
article-image-cms-made-simple-16-orders-and-payments-e-commerce-website
Packt
18 Mar 2010
13 min read
Save for later

CMS Made Simple 1.6: Orders and Payments in an E-commerce Website

Packt
18 Mar 2010
13 min read
Module Cart This  module will add simple cart functionality to the Products module. Once installed, the Cart module will be automatically displayed in the detailed view of the product. The visitor of the website will then be able to put one or more products in the basket along with the desired quantity. There are other modules that you can use instead of the Cart module, like GiftBaskets. For our example Shop, it is enough to use the simple functionality of the Cart module. Install the module Cart from the list of available modules in the Module Manager. The admin area of this module will be added to Extensions | Cart in the admin console of CMS Made Simple. Time for action – connecting products and cart If you now look at your Shop page and open a detailed view of any product, you will discover that there is still no cart functionality in it. The reason for it is that the Products module does not know that the Cart module has been installed and is ready for use. Let's connect two modules. Open the admin area of the Products module (Content | Product Manager). Click on the Preferences tab. Select the Cart module from the field Cart Module. Click on Submit and open detailed view of any product. You should see the but on Add to My Cart in the detailed view of the product. If the product has some attributes additionally to the quantity field, then the attributes are displayed in a drop-down field besides it. What just happened? You have told the Products module what module has to be used for cart functionality. Test it and add some products to the cart right now. The products will be added, but there is no possibility to display the content of the cart for the visitor yet. Create a new content page called Cart and add the following Smarty tag as the content of the page: {Cart action="viewcart"} Save the page, then open the admin area for the Cart module (Extensions | Cart) and switch to the Preferences tab. Select the newly created page in the list of pages, so that the visitor is automatically redirected to the page after he has added the product to it. There are four templates that you can customize for the module: Template   Description   AddToCart This template controls how the quantity field, the button Add To My Cart (see the preceding screenshot) and optionally product attributes with price adjustment look like. MyCart This template is used to display the cart status. It is displayed at the place where the Smarty tag {Cart action="mycart"} is placed. It shows the number of items currently saved in the cart and the link to the cart page. Viewcart This template is used for extended display of all products saved in the cart. It shows all products with their quantities and prices and the total order price. Additionally it offers the possibility to start the checkout order process if the module Orders is installed. Product Summary This template is used to format the output used for each product summary in the Viewcart template. It allows customizing the product label based on the attributes, product name, and price. The Smarty tag {Cart action="mycart"} can be added to the navigation of the website, like the link to the Basket in the official shop (http://www.cafepress.co.uk/cmsmadesimple) we are trying to reproduce. It would appear as shown in the following screenshot: There is nothing else you should know about the Cart module. The next step will be to integrate the checkout process. Module Orders This module is designed for processing orders from the cart. This module handles billing and shipping addresses from the customer and either uses an external payment gateway (such as PayPal) to handle the payment process or performs manual e-mail-based invoicing. This module can also optionally collect credit card information and store it in the database for later offline processing. Even if the module offers the possibility, never collect credit card information in a low security shared hosting environment! The Orders module keeps track of all orders, and allows for the specification of items like tracking numbers and confirmation on numbers and sending e-mails to the customers related to a particular order. The functionality of the module can be extended with even more modules that allow configuring different taxes, shipping costs, and promotion actions (like discount or promotion coupons). This module has a lot of dependencies: CGExtensions FrontEndUsers Products CGSimpleSmarty CMSMailer CGPaymentGatewayBase From this list of dependencies, you can learn that it is based on the functionality of the module FrontEndUsers. This means that your website's customers must register before they can start the payment process on your online store. There is no possibility to turn off this registration process and it is required for the checkout step. Install all modules listed in the preceding dependencies list, then install the Orders module. Time for action – adding the checkout step To enable the checkout process provided by the Orders module follow these steps: Create a new content page (Content | Pages | Add New Content) and name it Checkout. Add the following Smarty tag to the Content field of the Checkout page: {Orders} Save and view the page in the browser. This page will display either the billing form if the user is logged in or the warning message if the user is not logged in or does not belong to special user group. To connect the Cart module with the new Checkout page, in the admin console click on Extensions | Cart. Select the tab Viewcart Form Templates and click on the Sample template (or your own template, if you have created one). At the very end of the template in the Template Text field, add the following line of code: {cms_selflink page="checkout"} The parameter page should contain the page alias of the page where the Smarty tag {Orders} has been added to the content. Open your shop and add one or more products to the cart,find a link to the page Checkout at the very bottom of the screen. What just happened? You have connected the module Cart with the module Orders by placing a link from the cart view to the checkout process. To test the link, add some products to the cart and click the Checkout link at the bot  om of the cart view. If you are not logged in, you will see the following message: The user is not logged in (or not a member of the required group) This message can be found in the template of the Orders module. But first, let's see an overview of the templates delivered with this module. In the admin console, click on Content | Order Manager and find the Templates link above the list of orders: Template name Template description Billing Form This template controls the first step in the order processing. It displays the form where the customer can enter billing address and one or more shipping addresses. Payment Form This template controls the second step in the order processing and is used to display the payment form for manual e-mail based checkout process. You will need this template if you do not use any payment services like PayPal, EMoney, EWay, or Authorize.net. Confirm Order This template controls the third step in the order processing and is used to display any information the customer entered in the first and optionally second step, so that the customer can confirm the shipping and invoice addresses or go back and correct them. Invoice This template is used in the admin area of the module Orders to print out the invoice or to send it via e-mail to the customer. Gateway Complete This template is used to display the status message after the payment has been made with any 3rd party service like PayPal, EMoney, EWay, or Authorize.net. User Email This template is used to customize the e-mail with order confirmation sent to the customer when the new order has been submitted. Admin Email This template controls the layout and content of the e-mail that is sent to the authorized administrator of the store when a new order is submitted. Message There is no sample template for the messages. Here you can define your custom e-mail notifications that can be manually sent to the customers from the admin area of the module. An example for such message can be an e-mail notification that is sent when the order is shipped. Now, we know where to start and how to proceed with customizing of the templates according to our requirements and payment configurations. Let's give the customer the possibility to register with or login to the website to be able to complete the checkout process. Integrating the login screen The message that indicates that the customer is not logged in is saved in the template Billing Form (the first step in the checkout process). The user is not logged in (or not a member of the required group). This is not very user friendly. Whether the user is registered or not we should give him a possibility to log in or to register on this page as shown in the following screenshot: The login form for registered customers can be displayed with the module FrontEndUsers. In the admin area of the Orders module, click on the Templates link and create a new template with the name My Shop on the tab. Scroll down to the very bottom of the suggested template text and the last ELSE condition: ... {else} {* user is not logged in, gotta make him *} <h3 style="color: red;">{$Orders >Lang('error_notloggedin')}</h3><br/> {/if} This is the place where the message that the user is not logged in is shown. Replace this section with the login screen of the module FrontEndUsers, as shown in the following code snippet: ... {else} <h1>Already registered?</h1> {FrontEndUsers} {/if} Save the template and do not forget to set it as Default to see changes on the website. Registered customers can now log into start the checkout process. But, what about customers who do not have an account? They should be able to register themselves with our website. As it gets a bit complicated I have created the following flowchart: The billing form checks if the visitor is logged in or not. If yes, he can fill in the billing information; if not, the login form of the FrontEndUsers module (step 3) is displayed. The steps 4 and 5 in the workflow should assist new customers by allowing them to register. These steps can be accomplished with the SelfRegistration module. Read the next section to see how the module can be configured. Before you continue be sure that: The CMSMailer module is configured and is able to send out messages There is a user property of type Email Address in the module FrontEndUsers (Users & Groups | Frontend User Management, tab User Properties). There is a user group that has the above user properties associated as Required (Users & Groups | Frontend User Management, tab Groups). Integrating customer registration This module is designed to allow visitors of the website to register themselves. It optionally sends a confirmation e-mail with an activation link that must be clicked before the registration is complete. Once the registration is complete, a user account is created in the module FrontEndUsers. Install the SelfRegistration module from the list of available modules in the Module Manager. For the registration page, create a new content page Register and add the following Smarty tag into the content of the page: {SelfRegistration group="Customers"} Pay attention to the part in bold in the above code. The value of the parameter group should exactly reflect the name of user group in the module FrontEndUsers (Users & Groups | Frontend User Management, tab Groups). Open the Register page of your website and sign in yourself as a new customer with the SelfRegistration module to see how the module works by default. There are some preferences in the module that can make the registration process user friendly. In the admin area of the Self Registration module (Users & Groups | Self Registration Module), click on the Preferences tab. The SelfRegistration module offers registration with an e-mail verification step or optionally single-step registration without any confirmation. If you do not need the e-mail verificafion, you should deselect the option Require the user to confirm registraion via email on the Preferences tab of the module. The three settings considering the final message work different depending on what registration method you have chosen. Setting With verification Without verification Don't display the final message after registration Prevents the registration form to be replaced by the confirmation message after the form is submitted. Prevents the registration form to be replaced by the final message after the form is submitted. PageID/Alias to redirect to after registration is complete N/A Redirects to the given page, but replaces the whole content of the page with the final message. PageID/Alias to redirect to after verification step is complete Redirects to the given page, but replaces the whole content of the page with the final message. N/A According to the workflow, let's add a link to the registration page for the new customers (step 4). In the billing template of the Orders module, open the template for the Billing Form again, scroll down and add a link to the registration page for the new customers as shown in the following code snippet: ... {else} <h1>Already registered?</h1> {FrontEndUsers} <h1>New Customer?</h1> {cms_selflink page="register"} {/if} Pay attention to the parameter page. It should contain the alias of the page where the registration form is displayed. Customize the Registration Template 1 of the SelfRegistration module that displays the registration form. Generally, there are two templates. The first one is for the registration form and the second one (Post Registration Template) contains the message informing the customer that his registration should be confirmed through a link sent to his e-mail address. Other templates that you can customize are as shown in the following table: Templates   Description   Registration Template 2 This template contains the form where the username, verification code and password will be added to complete registration. Confirmation Email Contains subject of the verification e-mail, the plain text and the HTML version of the e-mail sent out after the customer has registered. Final Message The message is shown to customer after the registration process is completed. To build the workflow suggested above (step 5) add link to the billing form in this template, so that the user can carry on with the checkout process. It is also advisable to tick the option Login user after registration, so that the login step can be skipped after registration. Lost Email This template contains a form for the customers that have registered but did not get verification e-mail. This template is shown at the place where the Smarty tag {SelfRegistration mode="sendmoremail"} is shown.
Read more
  • 0
  • 0
  • 2510

article-image-google-earth-google-maps-and-your-photos-tutorial-part-ii
Packt
17 Mar 2010
19 min read
Save for later

Google Earth, Google Maps and Your Photos: a Tutorial Part II

Packt
17 Mar 2010
19 min read
Part 2: Google Maps Section 1: Introduction to Part 2 When approaching any sufficiently high-level computing topic, it is often true that we need to be familiar with a broad range of underlying and related concepts to establish the foundation necessary to learn the new material. Virtually every technology not only borrows from, but also builds on others. Furthermore, it is often the case with programming projects that the bulk of the work comes at the beginning and involves carefully thinking through the problem, devising a solution, and building those parts of the project that we need to write before we can get to the code we want to write. In the first part of the tutorial we wrote a Perl script which allows us to generate valid KML files from collections of geotagged photos. Using our new tool, we generated a number of files containing all of the data (about our photos) that we'll use to populate our Google Maps. We also looked at the structure of KML, and covered a number of other important topics, which are key to understanding the material presented here. If you have not read part 1, do take the time at least to glance through it to confirm for yourself that you won't have trouble following along with this discussion. Now we turn our attention to Google Maps. After this short introduction we'll handle the tutorial in 3 parts. Part 1: This section discusses the document-object-model (DOM), which is a formal methodology for negotiating XML files, like the KML files we created in part 1. Part 2: Next we'll look at XHTML and the XHTML file we'll use to display our Google Map. As you'll see, the file included with the project is no more than a shell, but it does suffice to allow us to present our map. Furthermore, it affords us an opportunity to talk about integrating XHTML, Javacript, and the Google Maps API. There are a few important things we'll need to understand. Working with a simple page will help us avoid complicating the issues unnecessarily and will make it easy for you to relocate the map to a page of your own (maybe as part of a weblog for example) with a minimum amount of fuss. Part 3: Finally, we'll look at Javascript and the Google Maps API. Before we get to all of that, there are a couple of preliminary topics to talk about: XML We've already looked at XML, describing it as an open, extensible markup language. We've said that XML is a metalanguage which allows us to define other languages with specific syntactic structures and vocabularies tailored to discrete problem domains. Furthermore we've said that KML is one such XML-based language, engineered to address the problem of describing geographical data and the positioning of geographical placemarks and other features to display on a map, among other applications. XHTML We haven't yet talked about XHTML which is a reimplementation of HTML as a standard, XML-based format. HTML (Hypertext Markup Language) has served as the preeminent language for authoring documents on the World Wide Web since the web's inception in the late 1980s and early 1990s. HTML is the markup language1; which makes hypertext2; linking between documents on the web possible and defines the set of tags, i.e. elements and attributes, that indicate the structure of a document using plain-text codes included alongside the content itself. Just as the web was not the first hypertext system3, HTML was not the first markup language, though both have become extremely important. Without delving too deeply into the primordial history of markup, HTML is a descendant of SGML (Standard Generalized Markup Language) which is itself an offspring of GML (Generalized Markup Language). The Wikipedia entry for GML offers this description of the language: GML frees document creators from specific document formatting concerns such as font specification, line spacing, and page layout required by Script. SCRIPT was an early text formatting language developed by IBM, and a precursor to modern page description languages like Postscript and LaTeX, that describe the structure and appearance of documents. Not surprisingly the goal of GML is echoed in the intent of HTML, though the two are far removed from each other. Berners-Lee; considered HTML to be an application of SGML from the very beginning, but with a clear emphasis on simplicity and winnowing down much of the overhead that had always characterized formal markup languages. In the early days, the web had to struggle for acceptance. The birth of the web is a story of humble beginnings4. The significance of the web was by no means a forgone conclusion and early adoption required that the markup syntax of the web be as accessible as possible. After all, more stodgy languages already existed. The simplicity of HTML certainly contributed to the success of the web (among many other factors), but it also meant that the standard was lacking in key areas. As the web gained wider appeal there was a tendency to take advantage of the early permissiveness of the standard. Developers of mainstream web browsers exacerbated the problem significantly by tolerating noncompliant documents and encouraging the use of proprietary tags in defiance of efforts on the part of standards organizations to reign in the syntax of the language. In the short term, this was a confusing situation for everyone and led to incompatibilities and erratic behavior among an ever increasing multitude of documents on the web and the various web browsers available, which differed in their support for, and interpretation of, what were in essence emerging 'dialects' of HTML. These web browsers differed not only from one another, but also frequently from one version to the next of the same application. There was a real need to establish stability in the language. Lack of dependable syntax meant that the job of building a parser capable of adequately adhering to the standards, and at the same time accommodating various abuses of the standard, had become an exercise in futility. Unlike HTML, XHTML must strictly adhere to the XML standard, which means that any compliant XML parser can negotiate properly formatted documents with relative ease. This reliability paves the way for a more efficient and sophisticated web, resulting in not only more consistent rendering of content, but the development of software that is able to differentiate and act on content based on context, and relationships among data. This is one of the primary advantages of XML, as has already been discussed, and this is a key advantage of XHTML as well. Long term, Berners-Lee, who currently serves as the director of the World Wide Web Consortium (W3C); and a senior researcher at MIT's Computer Science and Artificial Intelligence Laboratory (CSAIL), continues to actively pursue the vision of a Semantic Web. That is, a web that can be mined as a rich repository of data by intelligent software agents, which not only present information, perform basic pattern matching, and the like, but are capable of analysing information (in a truer sense—keep this or get rid of it?). From the W3C's Semantic Web Roadmap we have this brief introduction to the concept: The Web was designed as an information space, with the goal that it should be useful not only for human-human communication, but also that machines would be able to participate and help. One of the major obstacles to this has been the fact that most information on the Web is designed for human consumption, and even if it was derived from a database with well defined meanings (in at least some terms) for its columns, that the structure of the data is not evident to a robot browsing the web. Leaving aside the artificial intelligence problem of training machines to behave like people, the Semantic Web approach instead develops languages for expressing information in a machine processable form. Whether this vision accurately predicts the future of the web remains to be seen. At the moment the Semantic Web is a veritable stew of protocols, frameworks, concepts, extensions, namespaces, vocabularies, schema, ontologies, and other components. It is the subject of much debate, virtually all of it far beyond the scope of this tutorial. But this 'brave new web' is not purely academic. The increased emphasis on standards-compliant markup has resulted in developers of web browsers and content creation tools steering their apps toward the standards. This in turn motivates authors to produce compliant documents. In fact the Strict variations of XHTML do not allow for deviation from the standards. Two immediate benefits of this work, whether or not it ultimately leads to some future web, are (1) more consistent document rendering across platforms among mainstream web browsers, (2) and the emergence of the Document Object Model (DOM). We'll look at the DOM shortly. Section 2: Object Models and the DOM An object model is a collection of objects and the typically hierarchical, often complex, relationships among them, where the most generic definition of an object is simply a 'thing'. Object models are all around us and are not limited to programming or the broader topic of computing for that matter. If, for example, you were to describe a car in terms of its object model: You might start by talking about the chassis, or base frame, and then go on to describe the body of the car, its wheels, axles, exhaust system, the drivetrain, etc.; everything that is directly attached to the frame. For each of these you could describe various attributes and elements of that object; for e.g. the body material is an attribute of the body object. The elements may in fact be other objects that collectively comprise those objects within which they are contained. The body of the car contains the engine compartment, passenger compartment, and trunk elements. The engine compartment includes the engine which is itself a collection of smaller objects. The passenger compartment can be described as the collection of front and rear compartment objects, where the front compartment object includes at least a driver side compartment with a steering wheel, instrument panel, etc. These objects have their own attributes and elements perhaps consisting of other objects each of which is an object itself, with a more specific function than the objects in which they are contained. If you've ever put together a toy model of a car you may remember seeing an exploded schematic diagram of the completed model which clearly shows all of the objects from the largest container elements to the smallest ties, screws and other fasteners that hold all of the pieces together. This is a nice way to visualize the object model of the toy car. Of course the object model I have described is only an informal example. It may be fair to dispute the model I've sketched here. As long as you have a better general understanding of what an object model is then this example has served its purpose. Object models are very common within the realms of computer technology, information technology, programming languages, and formal notation. The Document Object Model The Document Object Model (DOM); is a standard object model for describing, accessing and manipulating HTML documents and XML-based formats. The often quoted description of the DOM from the W3C's site dedicated to the specification is: The Document Object Model is a platform- and language-neutral interface that will allow programs and scripts to dynamically access and update the content, structure and style of documents. The document can be further processed and the results of that processing can be incorporated back into the presented page. Remember that XHTML is a special case of XML (i.e. it is an XML based format) and essentially no more than a formalization of HTML. Because it is an XML based format the XML DOM applies. Furthermore, because XHTML describes a single format with a number of required structural elements and only a limited collection of allowable elements and attributes, the HTML DOM has a number of unique objects and methods for acting on those objects that are not available in the more generic XML DOM. Having said that, I want to emphasize the the two are more alike than the are different. Technically we will look at the XML DOM here but nearly everything discussed is applicable to the HTML DOM as well. Though there are differences, some of which we'll encounter later in this tutorial, as an introduction it is appropriate to limit ourselves to fundamental concepts, which the two share in common. We need both. We'll rely on the XML DOM to parse the KML files we generated in part one of the tutorial to populate our Google Map, and the HTML DOM to add the map to our webpage. By the time we've completed this part of the tutorial hopefully you will appreciate just how integral the DOM is for modern web design and development, though we'll only have skimmed the surface of it. The concept of the DOM is actually quite easily understood. It will seem intuitive to anyone who has ever dealt with tree structures (from filesystem hierarchies to family trees). Even if you haven't had any experience with this sort of data structure, you should anticipate being able to pick it up quickly. Under the Document Object Model individual components of the structure are referred to as nodes. Elements, attributes and the text contained within elements are all nodes. The DOM represents an XML document as an inverted tree with a root node at the top. As far as the structure of an actual XML document is concerned, the root is the element that contains all others. In every structure all other nodes are contained within a document node. In the KML files we've generated the Document element is the root element. Every other node is a descendent of Document. We can express the reciprocal relationship by stating that Document is an ancestor of every element other than itself. Relationships among nodes of the document are described in familial terms. Direct descendants are called child nodes or simply children of the their immediate ancestor, referred to as a parent. In our KML files, is the only child of . (It would be just as correct to say that is the parent node of .) Note that there could be more than one Folder node. We could use additional folders to group Placemarks (a) by year, with one folder per year, (b) by event, with each folder dedicated to a single event, or (3) by image gallery so that each folder corresponds  to a discrete image gallery, or maybe some combination of these and other criteria. Furthermore, we can have more than one type of child node under a single parent. For example Placemark is the parent node of , , and in our files. These nodes can all be described as siblings, because they all have the same parent. Also, notice that is a child of , and a grandchild (not a child) of Placemark. We can make a couple of other useful observations about this structure: Every node other than the root has exactly one parent. Parents may have any number of children including zero, though a node without any children won't be referred to as a parent. (A node with no children is called a leaf.) Implicitly there are other familial relationships among nodes. For example, elements with parents that are siblings could be thought of as 'cousins' I suppose, but it is unusual to see these relationships named or otherwise acknowledged. There is one important subtlety. Text is always stored in a text node and never directly in some other element node. For example, the description elements in our KML files contain either plain text or html descriptions of associated Placemarks. This text is not contained directly in the description node. Instead the description node contains unseen text node which contains the descriptive text. So the text is a grandchild of the description node, and a child of a text node, which is the direct descendent of description. Make sure that you understand this before continuing. Because of the inherent structure of XML, we can unambiguously navigate a document without knowing anything else about it, except that it validates. We can move around the tree without being able to name the nodes before we begin. Starting at the root document node, we can traverse that node's children, move laterally among siblings, travel more deeply from parent to child, and then work our way back up the tree negotiating parent relationships. We haven't yet described how we move among siblings. The DOM allows us to treat siblings as a list of nodes, and take advantage of the relationships that exist among elements in any list. Specifically, we can refer to the first (firstChild) and last (lastChild) nodes to position ourselves in the list. Once we are at some location in the list, we can refer to the previous (previousSibling) and next (nextSibling) nodes to navigate among siblings. Programmatically we can use the DOM to treat siblings in a XML data structure as we would any other list. For example, we can loop through sibling nodes working on each node in turn. Keep in mind that we are using generic terminology, not referring to specific node names and we are relying only on the structure of XML which we know must be dependable if the document adheres to the standard. This will work well for our KML files, and it is certainly not limited to KML. There are primarily two techniques we can use to find and manipulate elements in our XML structure using the DOM. Node PropertiesFirstly, we can take advantage of relationships among element nodes as we have been discussing.A number of node properties, some of which have already been mentioned, allow us to move between nodes in the structure. These include: firstChild,lastChild,previousSibling,nextSibling,parentNode If we look at a fragment of KML, similar to the KML files generated in part 1 of the tutorial, starting at the Placemark element... <Placemark>     <name>value</name>     <Snippet maxLines="1">         value     </Snippet>     <description><![CDATA[         value         ]]></description>     <Point>         <coordinates>value</coordinates>     </Point> </Placemark> ...we see a number of these properties: is the firstChild of is the lastChild of The nextSibling of is The previousSibling of is is the parentNode of , , , and getElementsByTagName()Secondly, we can use the method getElementsByTagName() to find any element regardless of the document structure.For example, using the syntax... getElementsByTagName("name") ...we can retrieve all elements as a nodeList from the document which are descendants of the element we are using when we call the method. The following Javascript statement returns a list of all elements in the document and stores that list at the variable list_of_nodes. var list_of_nodes = getElementsByTagName("name"); What is a node list? A node list (NodeList) is an object representing an ordered list of nodes, where each node represents an element in the XML document. The order of the NodeList is the same as the order of the elements in the document. Elements at the top of the document appear first in the list, and the first element returned, i.e. the first position in the list, is numbered 0. Keep in mind that the list includes all <name> elements. If you look at the KML files we've generated you may notice that both <folder> and <placemark> elements contain <name&gt. We need to be aware that getElementsByTagName("name") will return all of these if we are starting at the document root. We can differentiate between these <name> elements in a number of different ways. For example we can insist that the node is a child of a Placemark node to exclude <name> elements that are the children of <folder> elements. We need to be able to refer to various properties of these nodes if we are going to act on them in any reasonable way. The XML DOM exposes several useful node properties incl: nodeName, nodeValue, and nodeType. nodeName: is (quite obviously) the name of the node. What might be less obvious is precisely how the DOM defines nodeName. The tag name is always the name of an element, e.g. 'Placemark' is the name of the <Placemark> elements The attribute name is the nodeName of an attribute, e.g. the name of the maxLines attribute of <Snippet> is 'maxLines' The name of any text node is always the string '#text'. e.g., the plain text or html that we're using as our Placemark descriptions are each contained in a text node, as has already been discussed, and the name of this text node is '#text', and not the name of the element which surrounds the value in the XML document The nodeName of the root document node is always the literal string '#document'. nodeValue: is what you might expect. The value of text nodes is text itself. So the text node of one of our Placemark elements is all of the plain-text or html within the description tags. Again, as far as the DOM is concerned the text is actually contained within a text node which is a child of a description node The value of an attribute node is simply the attribute value. e.g. maxLines="1" has a nodeValue of 1 nodeValue is not defined for the document node and all element nodes. nodeType: is certainly not something you could guess. A specific value is assigned to each of the available types (categories) of nodes. The following is an incomplete list of common node types. Element, type 1 Attribute, type 2 Text, type 3 Comment, type 8 Document, type 9 As I have already said, we will take advantage of the DOM to parse our KML files and populate our Google Maps. Many of the ideas we've seen here will seem much more concrete when we put them to use. Still, this has been a very brief look at an interesting topic that is especially important to web developers and designers. I would recommend that you pick up a book that does a good job of describing the document object model if you are planning on doing any significant amount of that kind of work. This need not be an intimidating topic, though I have found that the majority of books and articles do an inadequate job with it. If you are only interested in following along with this tutorial then this brief treatment of the DOM, the comments in the included source files, and the javascript code itself should be sufficient for you to complete the project.
Read more
  • 0
  • 0
  • 1725

article-image-multi-user-environment-mediawiki-11
Packt
12 Mar 2010
2 min read
Save for later

Multi-user Environment in MediaWiki 1.1

Packt
12 Mar 2010
2 min read
Many organizations use MediaWiki as the platform to deliver content with no option for editing or creating. Even though these options exist, in its truest form, a wiki is a collaborative environment. This means we may have multiple users accessing the system and participating in building the wiki. The count might be more than few thousands for a given moment if the site is popular. With any platform that caters to a diverse group of people, issues are bound to arise. Contributors may make mistakes in their articles, there may be conflicts over changes made to a page, and many other issues can arise when dealing with people. Working in a multi-user environment definitely has its advantages, but as a wiki administrator, it is important to keep in mind that not all users have good intentions. As the system is open, anyone—including malicious users with bad intentions—can partake in any activity on the site. An open system can face a lot of user-related problems. The first major problem is that anyone can edit or add contents. This can be dangerous if the added content is not legal or if it is copyrighted. As the user can avoid being tracked, the site has to take the responsibility for such acts. Another major attack can be on the content itself—people with bad intentions can change content without any reason or present false information. Vandalism is also a common occurrence on such sites, and the concerns regarding false information have plagued even the most well-respected of sites—Wikipedia. In this article, we will take a detailed look at these issues and learn how we can address them.
Read more
  • 0
  • 0
  • 1120

article-image-set-your-own-profile-mahara-part-2
Packt
12 Mar 2010
6 min read
Save for later

Set up your own Profile in Mahara: Part 2

Packt
12 Mar 2010
6 min read
Adding a text box to your profile page One useful thing you can add to your profile page, or any View, is a text box. These are extremely useful for giving meaning to your web page. You can use the text box to put in descriptions or snippets of information that help structure your View in a more logical way. In the next Time for action section we look at how exactly you add a text box to your profile page. Along the way, you will encounter for the fi rst ti me Mahara's drag-and-drop user interface for adding items to Views, which is is very exciting! One of the things that make Mahara stand out is its flexible framework for creating web pages. It is extremely intuitive as you will see, and reflects in some ways how you would create a poster display—taking bits of information such as text and pictures, moving them around until you are happy with their location and then sticking them in place. Of course, the advantage is that, with Mahara, they aren't stuck down forever with glue and can be repositioned whenever you like. Let's add a text box to our profile View. Time for action – creating a text box for your profile page Click on the Edit Profile Page button in the Profile submenu. You will see a page that looks a bit like this: You will notice that you are being encouraged to select different blocks from within a set of six tabs at the top of the screen and drag them down onto your View page. Later we will be looking at these blocks and learning how to position them on our page. However, right now we are focusing on how to work with the text box. Click into the tab called General. You should see this: Click and drag the text box icon somewhere onto the space below to position it amongst the other blocks already on your View layout. You will see the other blocks move as you are dragging to make space for the text box. You will also see a dotted gray line showing you where the new block will appear. Here is a basic diagram showing the drag-and-drop action: Can't drag and drop in Internet Explorer 6.The functionality allowing us to drag blocks around the page when we are editing a Mahara View is enabled by JavaScript. Most modern browsers support JavaScript as default, including Firefox, Safari, and Internet Explorer 7 and 8. Unfortunately, many people are still running Internet Explorer 6 and Mahara's drag-and-drop facility won't work in this browser because of problems (or bugs) it has with layout that newer browsers don't. You can still use IE 6 without the drag and drop feature, and use the radio buttons instead, but we recommend you to upgrade your Internet Explorer browser or (even better) download an open source browser such as Mozilla's Firefox: www.mozilla.com/firefox/. A box will open. Click into the Block Title and add your title. Click into the Block Content box. Type in here the body of your text box. Janet Norman decided that she would like to have some information about Mahara on her profile page. Click Save to finish and that's it, you've added you first text box. What just happened? You just added a text box to your profile page. A section on your View is called a block, and you've just learned how to add a new text box by clicking and dragging it onto your profile page. Blocks are what Mahara uses to personalize your profile page and your Views. You can add and delete blocks, and move them around. There are actually quite a variety of blocks, and the Mahara developers are keen to keep adding to the list. We have started here with a basic text box, as it's probably the one you will use most frequently. One of the things you probably noticed when adding text to your text box was that you have a number of editing options available. Janet would like to make her text look more interesting, so let's revisit our text box and look at what these options do. Options in the text editor You will probably find that you have already used most of the options in the text editor when working in word processing programs. Let’s have a quick look at some of the most commonly used options. Icons Function These icons can be used to make your characters bold, italicized, or underlined   Align your text to the left, to the center, to the right or justify your text into a square, newspaper-style layout.   Add bullets or numbers to your lists of text.   To toggle your page into HTML mode.   Add a hyperlink to your text.   Break an existing hyperlink.   Now let's try formatting some of the text you have just entered. Time for action – editing a text box by adding a hyperlink Open the text block you created earlier for editing. You can do this by clicking on the icon that looks a little bit like a cog at the top of the block. We are going to add a hyperlink to the text. Did you notice that the two link icons are grayed out and unclickable? This is because you can't hyperlink to something before you have highlighted it. Do this by clicking and dragging you mouse over the text you want to hyperlink. Now you should see the two hyperlink buttons in color. Click the Make Hyperlink button (the one that looks like a chain) to start creating your hyperlink from the word(s) that are highlighted. Jane has chosen to make a link from the word "Mahara" to the Mahara website. You should see a new dialogue box similar to the one below: You now get the chance to enter your link. Jane therefore enters a link to the Mahara website http://mahara.org. She has also added a Title to her link. This title displays when the user hovers over the link. Click Insert, which will create your link. To finish, remember to click Save, otherwise you will lose the work you have just done. You should see the link highlighted in a different color: What just happened? You just edited a text box by adding a hyperlink. In the last section, we showed you that HTML editing is one of the options in the text editor. Web developers have traditionally used HTML code to write their web pages. It will be useful for regular Mahara users to learn a bit of basic HTML in order to gain more control over their Mahara View pages. The World Wide Web Consortium offers free, beginner-level HTML tutorials at http://www.w3schools.com/html/.
Read more
  • 0
  • 0
  • 1098
article-image-set-your-own-profile-mahara-part-1
Packt
12 Mar 2010
7 min read
Save for later

Set up your own Profile in Mahara: Part 1

Packt
12 Mar 2010
7 min read
For this article, we are going to concentrate on the Profile tab of the main menu. The very first thing that most Mahara users want to do is customize their own profile space, making it unique to them. We will show you how to do that. For the following examples, we will be working with Janet Norman of PI Inc, showing you how she has configured her profile space. Why not set up your own profile in the demonstration site as you work through the examples? Let's start by looking at profile information. Profile information Later you will set up your own profile page—showing yourself and your knowledge off to others in an attractively personalized way. However, before you do that, you need to add some profile informati on. Your profile information is the first example we will see of "stuff " that you can add to Mahara. When we say stuff we simply mean informati on, or items that can then be viewed later or arranged into web pages, which we will see when we look at your profile page. You are now going to set up some profile information as "stuff " that you can select from and use. We will look at three types of profile information—your profile itself, profile icons, along with your resumé, goals, and skills. Editing your profile Let's show you how to edit your profile. Any information you enter into your profile is private from everyone except the Mahara Site Administrators. You will get to choose who can view what, later on in the Mahara process. Time for action – editing your profile Click the Profile button on the main menu. You will notice that Mahara has opened the Profile submenu. The Edit Profile tab is selected when you first enter your profile space. Let's take a quick look at Janet's profile. You will notice that the About Me tab is selected. Janet has already entered her name. Say something about yourself! Scroll down to the Introduction section of the About Me page and enter some text. Here is what Janet Norman typed in: Whenever you make any changes, click the Save Profile button at the bottom of the page. Next, click the Contact Information to the right of the About me tab. You will see that you are expected to fill out some telephone numbers and addresses. The first thing you should notice is that you can have more than one e-mail address in a Mahara site. To add another e-mail address, click the link to Add email address. The e-mail address will receive a confi rmati on e-mail from the Mahara site and you will have to go to your e-mail account and follow the link to confirm it is genuine. You can now use radio buttons to toggle which e-mail address you would like to use as default for your account. This selection is important because it is at this address that you will receive system messages. You will also noti ce that you can delete an e-mail address by clicking the small, red-colored cross to the right of the e-mail address. Fill in your contact information on this page. Remember, you don't have to complete all the fields if you don't want to. Click the tab called Messaging. Mahara will bring together the types of people you are likely to engage with in live text, audio, and video conferences. People can display these contact details to each other in their profile page and other web pages. Enter your contact details for the facilities you use on this page. If you are still not using live conferencing tools, perhaps now is the time to start thinking about it. Finally, click the tab called General. On this page enter your Occupation and Industry (remember to click the Save Profile button when you have finished). Janet Norman typed this: What just happened? You have just completed your profile by entering some information about yourself, including your personal information, what messaging/conference tools you use, and your Industry background. Both the Contact Information and Messaging information are private and will only be seen if you add them to a web page. This is because you don't necessarily want anybody in the Mahara site to be able to see your telephone number and address for security reasons. Help!If you have found so far that you wish you had a bit more information about what certain options do, then don't worry! Mahara is very well documented software. On most pages, you will see litt le question mark icons. If ever in doubt, click on these and you will be given very useful and specific help relati ng to your area of doubt. Let's now continue to add some more stuff into our profile, with profile icons. Profile icons Profile icons bring your profile to life! They are the first thing that people see about you when they are interacting with you in different areas of the site. Mahara allows you to upload up to five different profile icons. This becomes very useful when you are making web pages out of your stuff . You can present yourself to different audiences in different ways, simply by altering your profie icon. For example, you can display a serious passport photo to your professional work colleagues, a more informal photo to your closest work colleagues, perhaps an avatar for public groups where you would like to be a bit more anonymous, and a picture of you having fun at a party for some of your more social interactions. Time for action – uploading your profile icons Let's get a few different profile icons online. Click the Profile submenu button called Profile Icons. Click Browse to find the profi le icon you want to upload from your computer or USB stick (or wherever). Don't forget to add an Image Title for your profile icon before you click the upload button. You are allowed to upload up to five profile icons and you can delete any icon at any point. You will need to choose one of your icons as your default profile icon which should probably be a fairly sensible one. Janet Norman has already uploaded two profile icons: What just happened? You have just uploaded a profile icon to represent yourself in your Mahara site. As we saw in the Time for action section, Janet has uploaded two icons. One of these is an avatar of herself and the other is the company logo. She plans to use the company logo in places where she would like to appear more professional, whereas the avatar will be used more generally. Make yourself an avatar! An avatar is simply a character or cartoon representation of yourself. If you don't want a passport photograph as your profile icon, an avatar is a good alternative. There are many websites that help you create your own. A few of the most fun include the Simpsons Avatar Maker (http://www.simpsonsmovie.com), DoppelMe (http://www.doppelme.com), and Mr Picassohead (http://www.mrpicassohead.com). Editing your resumé goals and skills No longer will you need to trawl through ancient hard drives trying to find the resumé you last wrote five years ago. Instead, you can keep your resumé information within your Mahara system and update it when you make changes. How impressive will you look when you show your resumé to your prospective employer as a web page rather than on a piece of paper. There are three tabs remaining in the profile submenu that allow us to add stuff to our site. The remaining things we can add are: Resumé information: You can record your career and educational achievements. Goals information: Here you can set ourselves personal, academic, and career-related targets for your future. Skills information: You can record for yourselves what you perceive to be your personal, academic, and work-related skills.
Read more
  • 0
  • 1
  • 2775

article-image-multi-user-environment-mediawiki-11-sequel
Packt
12 Mar 2010
9 min read
Save for later

Multi-user Environment in MediaWiki 1.1- A Sequel

Packt
12 Mar 2010
9 min read
Time for action-reverting to previous content In our example, it appears that someone has not only changed the text for one of our pages, but someone has vandalized it as well. While one edit may be a legitimate change, as the sysop we don't want this page edited by the public, so we are going to revert to the previous page. In the case of vandalism, we have no other choice than to go back to the clean version of the page. The following screenshot shows the two changes made to the page. Following the screenshot, we will learn how to revert to the original page. Open your wiki and navigate to the page you wish to make changes to. Click on the history tab at the top of the page and you will be taken to the page history. Locate the time and date of the revision you wish to revert to. Click on the ti me and date link. In our example, we selected 21:39, 14 September 2009. We will now be taken to the page that existed on that date, and at that time. Click on the edit tab at the top of the page. You will now be taken to the editing page. As we are reverting, we don't need to make any changes. It is good practice to put something in the edit summary referring to the fact that you reverted to an earlier page. Click on Save page. A newline will be added to the page history reflecting the changes you just made as shown in the following screenshot: In the case of vandalism, it may be wise to check the contribution history of the user who vandalized the article by clicking on their IP address or user name. Clicking on their IP will often bring you directly to their user contribution page. If you are able to click on their user name, that will bring you to their user page. In the lower-left corner, there is a toolbox with a User contributions link. Click on this link. If this user is vandalizing many articles, you may need to take action. What just happened? When we noticed that our page had been edited and we did not approve of the changes, we used the page history to revert to an earlier version of the content that met our approval.In our example, we were able to revert from a legitimate change as well as an attack by a vandal. We also learned that when a vandal strikes our wiki, we may want to check their User contributions page to see what other articles they may have wreaked havoc on. More administrative tools MediaWiki has quite a few more tools that the administrator can use to help monitor a multi-user wiki. While some of these have been mentioned already in the text, such as edit summaries and minor changes, they need further explanation. Edit summaries We had a brief discussion about edit summaries in the last exercise when we were reverting to an earlier revision of a page. It is highly recommended that anyone editing a page fills in the Summary field because it makes it easier for you and your fellow contributors to understand what has been changed. It is also extremely helpful when going through the history of the page. The edit summary box can hold one line of 200 characters. If you attempt to enter more than this, only the first 200 characters will be displayed and the rest will be disregarded. In the case of a small addition to an article, it is highly recommended the full text of this addition be copied to the Summary field, giving a maximum of information with a minimum of effort. This way, readers of the summary will be unlikely to check the page itself as they already know the extent of the edit. These kinds of summaries allow users to check Recent changes, page history, and User contributions very efficiently. In addition to a summary of the change itself, the Summary field may also contain an explanation of the change. Note that if the reason for an edit is not clear, it is more likely to be reverted, especially in the case that some text is deleted. To give a longer explanation, use the talk page and make a note about it in the edit summary. After saving the page, the summary cannot be edited, so try to avoid any errors. Minor changes If you look at the previous screenshot, you will see a check box labeled This is a minor edit.Minor edits have been glossed over in this article but now, we will give them a bit more attention. When editing a page, logged-in users may mark a change to a page as a minor edit. Minor edits deal with changes such as correcting a type, changing the format of the content, or changing the presentation of the content. Minor edits usually do not involve changing the actual content of the page. By contrast, a major edit makes the article worth reviewing for anyone who watches it closely. Therefore, any change that affects the meaning of an article is not minor, even if it involves one word. The distinction between major and minor edits is significant because you may decide to ignore minor edits when viewing recent changes. Logged-in users can even set their preferences to not display such edits. No one wants to be fooled into ignoring a significant change to an article simply because it was marked minor, of course. So remember to consider the opinions of other editors when choosing this option. Users who are not logged into the wiki are not able to mark changes as minor because of the potential for vandalism. The ability to mark changes as minor is another way you can entice your visitors to register. It is always better to mark the edit as minor if you are doing the following changes: Spelling corrections Simple formatting (capitalization, bold, italics, and so on) Formatting that does not change the meaning of the page (for example, adding horizontal lines or splitting a paragraph into two where such splitting isn't contentious) Obvious factual errors (changing 1873 to 1973, where the event in question clearly took place in 1973) Fixing layout errors We have to remember the following things when we are marking an edit as minor edit: Any change to the wikitext, even if it does not affect the presentation of the page in HTML (for example, adding a space or a line break), will still be treated as a change according to the database. Marking a major change as a minor one is considered bad manners, especially if the change involves the deletion of some text. Reverting pages is not likely to be considered minor under most circumstances. W hen the status of a page is disputed, and particularly if an edit war is brewing, then it's better not to mark any edit as minor. Reverting blatant vandalism is an exception to this rule. A user's watchlist will only list the most recent change made to a page, even if that edit was minor. Therefore, a minor change will supersede a major one in the watchlist. This is because a user who keeps a watchlist is generally interested in all changes made to a page. If you are uncertain about the changes made to a page, double-check the page history. If you accidentally mark an edit as minor when it was in fact a major edit, you should make a second "dummy" edit, but make a note in the edit summary that "the previous edit was major". As a trivial edit to be made for this purpose, just opening the edit box and saving (changing nothing) will not work, neither will adding a blank space at the end of a line or a blank line at the end of the page—in these cases the edit is canceled and its summary discarded. However, you can add an extra space between two words, or can even add a line break. These changes are preserved in the wikitext and recorded as a change, although they do not change the rendered page. It may be worth communicating any disagreement about what is minor via Talk or a message to the contributor, being careful to avoid a flame war with other users. There is a gray area here, and many contributors will appreciate feedback on whether they've got it right. It is also good to remember the following terms since we are using them every now and then: Dummy edit: A dummy edit is a change in wikitext that has little or no effect on the rendered page, but saves a useful dummy edit summary. The dummy edit summary can be used for text messaging, and correcting a previous edit summary such as an accidental marking of a previous edit as "minor". Text messaging via the edit summary is a way of communicating with other editors. Text messages may be seen by dotted IP number editors who don't have a user talk page, or editors who haven't read the subject's talk page, if it exists. A dummy edit should be checked as "minor" by logged-in editors. Consider the following example: Changing the number of newlines in the edit text, such as putting a newline where no newline exists or adding one more newline to two existing newlines, has no effect on the rendered page. But changing from one newline to two newlines makes a rendered difference as it creates spacing between the contents in Mediawiki and may not be a dummy edit. Adding newlines to the end of the article will not save as a dummy edit. Dotted IP number editors are editors who are referred to by their IP address in the dotted decimal notation rather than a username, for example, 192.168.1.230. Null edit: A null edit occurs if a page save is made when the wikitext is not changed, which is useful for refreshing the cache. A null edit will not record an edit, make any entry in the page history in recent changes, and so on. The edit summary is discarded. Consider the following examples: Opening the edit window and saving. Adding newlines only to the end of the article and saving is also a null edit.
Read more
  • 0
  • 0
  • 1219

article-image-managing-menus-joomla-15-part-2
Packt
12 Mar 2010
9 min read
Save for later

Managing Menus in Joomla! 1.5: Part 2

Packt
12 Mar 2010
9 min read
Time for action—tweak the menu position and orientation Placing a second menu in the left-hand side column makes it very prominent. You might notice that site visitors find this second menu distracting. And after all, the static links to information about SRUP aren't really that important. Why not move the menu somewhere down the page? We'll publish the SRUP links as a horizontal menu at the very bottom. By default, at the bottom of the screen there's a copyright notice. We'll start by removing this to make room for the new menu. Removing the copyright notice involves deleting a few lines of code from the template HTML. If you want to move the menu to any other screen position you can skip the first three steps: Navigate to Extensions | Template Manager. Select the rhuk_milkyway template and click on Edit HTML. In the HTML editor screen, find and select the following code: <p id="power_by"> <?php echo JText::_('Powered by') ?><a href="http://www.joomla.org">Joomla!</a>.<?php echoJText::_('Valid') ?> <a href="http://validator.w3.org/check/referer">XHTML</a> <?php echo JText::_('and') ?> <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a>.</p> Press the Delete key to remove the selected code and click on Save. You can preview the frontend to check if the copyright notice has effectively disappeared. To have the About SRUP menu occupy the free position, we'll edit the menu module properties: Navigate to Extensions | Module Manager and click on the About SRUP menu module. In the Position drop-down box, select syndicate. This is the bottom most position in this template. In the Parameters section, click on Module Parameters and set the Menu Style to Legacy – Horizontal. This will make Joomla! display the links horizontally side by side in a table row. Click on Other Parameters. In the Spacer text box, enter a character to display in between the horizontal links. In this example, we'll enter two dashes. The effect is that the menu links will be displayed as follows:Who are SRUP? -- Mission Statement -- Contact Click on Apply and click on Preview. The menu has been moved to the bottom of the page: What just happened? We've just removed the copyright notice that by default appears at the bottom of the template. This creates room for a separate "About SRUP" menu. To get this menu to display at the bottom position we've changed its module position and the menu style (the links orientation) from the default values. The result is that the menu is now displayed as row of links at the bottom of the page. This makes them much less prominent. Only visitors looking for these links will really notice them. This kind of presentation is a good choice for links that don't fit the main navigation menus. In this example, we've moved links on the organization behind the site to the bottom menu. In real life, it's common to publish static links there (such as About This Site, Disclaimer, and Sitemap). Menu Manager or Module Manager?To customize a menu, you'll sometimes use the Menu Manager, and sometimes use the Module Manager. What's the difference? The Menu Manager is used for everything that has to do with the contents of the menu. Anything to do with the display of the menu module you control through the module settings. Option 3: Creating submenu items There's still room for improvement in our Main Menu. Although there are now only five links left, the way they're organized might still confuse visitors. Having a News link and a separate News Archive link, both on the same menu level, is odd. Visitors will expect a News link in a main site menu, but News Archive shouldn't really be a top-level link. Joomla! allows you to add a secondary level to a menu so let's change News Archive into a secondary link that will only display after the News link has been clicked. Time for action—create a secondary menu item Let's remove the News Archive link from the primary level in the Main Menu and show it as a sublevel link: To edit the Main Menu contents, navigate to Menus | Main Menu. Click on the title of the item you want to edit, News Archive. In the Menu Item Details section, the parent item is set to top. Change the parent item to News: Click on Save. In the list of menu items in the Menu Item Manager, the new sublevel menu item is shown indented: Click on Preview to see the output on the frontend. The Main Menu now shows four primary links. When the visitor clicks on News, a secondary link News Archive is displayed: What just happened? By assigning a parent item to a menu link you can create a submenu item. Of course, submenus aren't the only way to make secondary content visible. The main links, can point to overview pages with links to content from sections or categories. Those "secondary home pages" can make secondary menu links superfluous. However, sometimes it's better to add sublevels in the menu itself. If you have items outside of the section or category structure (such as uncategorized pages), submenus can clarify the coherence of the site. You can have main ("parent") links and secondary ("child") links. Creating split submenus When you want to use submenus on your site, you can also choose an altogether different presentation from what you've just seen. You're not limited to having submenu items shown within the main menu, as it's also possible to place main navigation links horizontally along the top of the page and display second level links in a separate menu (for example, in a vertical menu in the left-hand side column). This creates a clear visual distinction between the main menu items and their submenu items. At the same time the visitor can see that those two menus are related. The parent item can be displayed as "active" (using a different style or color) when the related submenu is displayed. An example is shown in the following screenshot. The primary link, Activities, is shown in a (horizontal) main menu bar. When this link is clicked a separate submenu shows secondary links (submenu links) to two category overview pages (Meetings and Lectures): How do you build this kind of menu system in Joomla!? In short, you create a copy of the main menu, set the original main menu to show only the top-level links, and set the copy to show only the second-level links. Joomla! will automatically display the appropriate submenu when the parent item is chosen in the top menu. We won't add a split menu system to our example site as it doesn't have the amount of content that would justify an elaborate multi-level navigation. However, feel free to experiment on your own website, as this is a very powerful technique. The following are the required steps in more detail: Suppose you have created a Main Menu with two or more links to sublevel items. Navigate to Extensions | Module Manager. Select the Main Menu module and click on Copy. The same list now contains an item called Copy of Main Menu. Open that copy and enter another title (for example, Submenu). Select Position: left. In the Module Parameters, set the Start Level to 1 and the End Level to 1. This will make the menu display only second-level menu items. Now edit the Main Menu module to show only the top-level items. Set Start Level to 0 and End Level to 0. The menu is done! The submenus now only display when the corresponding main-level link is clicked. Have a go hero—arrange menus any way you like Joomla!'s split menu capabilities allow you to design exactly the type of navigation that's appropriate for your site. You can place a row of main menu links at the top of the page and position secondary (submenu) links in the left-hand side or right-hand side column. Try to figure out what arrangement of main and secondary links fits your site best and how you can realize this in Joomla!. Here are a few suggestions (some common arrangements of site navigation) to get you going: By default, Joomla's main menu links are displayed as a vertical row in the left-hand side column. How can you achieve a horizontal row of main menu links, as shown in the first three images above? Have a look again at the Time for action - Tweak the menu position and orientation earlier in this article. It shows the easiest way to change the menu orientation in Joomla!, selecting the appropriate Menu Style in the menu module editing screen. However, there are templates that are specifically designed to support horizontal menus. These contain the appropriate module positions and module styling for a main horizontal menu (and do a much better job at this than the default Joomla template). Exploring menu module settings When creating or editing a menu module, the module details and parameters allow you to control exactly where the menu is shown and how it displays. In many cases, the default settings will do—but if you really want control over your menus, it's a good idea to explore the wide range of additional possibilities these settings provide. In the Module Manager, click on the menu name (such as Main Menu or About SRUP). The Module: [Edit] screen appears. The three main sections of the Module: [Edit] screen are Details, Menu Assignment, and Parameters.
Read more
  • 0
  • 0
  • 1648
article-image-managing-users-php-nuke
Packt
09 Mar 2010
19 min read
Save for later

Managing Users with PHP-Nuke

Packt
09 Mar 2010
19 min read
PHP-Nuke is about web communities, and communities need members. PHP-Nuke enables visitors to your site to create and maintain their own user account, and add their personal details. This is usually required for them to post their own new stories, make comments, or contribute to discussions in the forums. Those annoying little tasks like managing lost passwords are also taken care of for you by PHP-Nuke. User accounts can be created in two ways: By the super user (that's you) By the user registering on your site The second method involves a confirmation email sent to the user's email account. This email contains a link for them to click and confirm their registration to activate their account (this needs to be done within 24 hours or the registration expires). Once a visitor is registered on your site, the gates to enjoy the full glory of your site will be thrown wide open. Visitors, or users as you could now call them, will be able to contribute to discussions on forums, add comment on posted stories, even add their own new stories, as well as access parts of the site that are off-limits to the 'riff-raff' unregistered visitor. Ingredients of a User Every user requires a certain amount of information to uniquely identify them in PHP-Nuke. There are the usual three things required of every user in PHP-Nuke: A nickname: This is an alias or username if you like. This identifies who the user is, and is their online identity in PHP-Nuke. A password: This is required to verify that the user is who they claim to be. A valid email address: This is where the confirmation email is to be sent. Once the user account is created for a user, the user is of course able to modify their details, and also view the details of other users. Information such as the URL of the user's own website, messenger ID (MSN, AIM, and others), their location, and interests are also part of the user 'profile', but are not compulsory. By default, the real email address of any user is never made public, for both security and to prevent harvesting by spammers. Users can specify a 'fake email' address, possibly in spam-obfuscated form (for example, address_at_mydomain.com) which will be displayed to other users, although this is not required. A user's privacy is always protected. Setting Up a New User User management starts by clicking the Users icon in the Modules Administration menu: Clicking on this icon brings you to the User's Administration panel. This panel consists of two mini-panels, Edit User and Add a New User , whose use is given away by their titles. We'll start by setting up a new user. Our user will imaginatively be called testuser. Time For Action—Setting Up a New User Manually If you're not at the User's Administration panel, click on the Users icon in the Modules Administration menu. In the Add a New User panel, enter testuser into the Nickname field. Enter Test User into the Name field. Enter your own email address into the Email field. Scroll down to the Password field. Enter testuser as the password. Click the Add User button. When the page reloads, you will be taken straight back to the administration homepage. What Just Happened? We created a new user. For this simple user, we only specified the required fields Nickname, Email, and Password, and provided a single piece of personal information, Name. Failing to specify the required fields will mean that the user is not set up, and you will be prompted to go back and add the missing fields. No email notification is sent to the user when the user is set up in this way, and no confirmation of the registration is required. As soon as you click Add User, provided all the required fields have been entered, the user is ready to go. Editing the details of a user is equally easy, but you do have to know their nickname to edit the details. Simply enter this into the Nickname field of the Edit User panel, select Modify from the drop-down box and click Ok! If you have taken a sudden dislike to a particular user, enter their nickname into the Nickname field and select Delete from the drop-down box, click Ok! and they are gone forever (the account, not the person). Subscribing a User Once a user has been created, you have the option to subscribe this user. We mentioned the idea of Subscribed Users in earlier articles; it's a mechanism for restricting module access to specific groups of people, such as fee-paying customers. There is only one group of Subscribed Users in PHP-Nuke at present, so once a user has a subscription, they are able to access any module restricted to Subscribed Users only. The option to subscribe a user is not available when you create the user manually, as we did above. To find the option, you have to edit the user's details. This is done by entering their username into the Edit User panel, selecting Modify from the drop-down box, and clicking on the Ok! button. The subscription options are near the bottom of the user details, underneath the newsletter option. The Subscribe User option does not refer to 'subscribing to' the newsletter; you sign up the user or remove them from your newsletter mailing list with the Newsletter option. The Subscribe User option makes the user into one of the site's elite, a Subscribed User. If you subscribe the user, then you must specify the Subscription Period. This is the length of time that the user remains subscribed, and ranges from 1 year to 10 years, in yearly increments. If you leave the Subscription Period at None then the user will not be subscribed. Once a user has been subscribed, you can change their subscription details from the same panel: You can unsubscribe the user, or extend their subscription period. To shorten the subscription period, you would have to unsubscribe the user, subscribe them again, and then set the new period. Subscribed users are reminded of the passing of time and the impending expiry of their subscriptions when they visit the Your Account module—we'll further explore this module later in the article: Time For Action—Registering as a User This time we'll register to create a user account as a normal visitor would. We'll call the user account userdude. If you do not have your mail server set up, then you will just have to follow the text and screenshots for now. The confirmation email sent by PHP-Nuke is a key part of the registration process, and includes a special link for the visitor to click to activate their account. Don't worry though, when your site is live on your web hosting account, you will undoubtedly be able to access a mail server. If you are still logged in as the super user, logout by clicking the Logout icon in either of the administration menus, or click the Logout link in the Administration block. If you are still logged in as testuser, logout by clicking on the Your Account link in the modules block, then click the Logout/Exit link in the navigation bar that appears: Alternatively, you can enter the logout URL directly: http://localhost/nuke/modules.php?name=Your_Account&op=logout You will be redirected to the site homepage. Now click the Your Account link in the Modules block: Click the New User Registration link. This brings you to the New User Registration panel. The top part of that panel is shown here: Enter the Nickname of userdude. Enter your own email address into the Email field. We are going to use userdude for the password as well as the nickname. If you think of another password at this point, enter it instead. Then put the password into the Re-type password field as well. Click the New User button. You will come to the final step of the registration process: Click the Finish button. Open up your email client, and log in to check your mail. You should find a mail with the subject New User Account Activation waiting for you. It will be from the email address you specified in the Administrator Email field in the Site Configuration Menu. The body of that email will look something like this: Welcome to the Dinosaur Portal You or someone else has used your email account ([email protected]) to register an account at the Dinosaur Portal To finish the registration process you should visit the following link in the next 24 hours to activate your user account, otherwise the information will be automatically deleted by the system and you should apply again: http://thedinosaurportal.com/modules.php?name=Your_Account&op=activate&use rname=userdude&check_num=64ad845758d7f8f572b12800f60842ba Following is the member information: -Nickname: userdude -Password: userdude Click the link in the email, or copy the link and paste it into your browser, and you will be taken to the New User Activation page where you will see a message of the form: userdude: Your account has been activated. Please login from this link using your assigned Nickname and Password. Clicking on this link takes you back to the User Registration/Login page of the Your Account module, and you can use your nickname and password to login. What Just Happened? You just created a new user account. The page for logging in is the homepage of the Your Account module. We'll talk more about this module in a minute; as you could guess, it handles everything to do with 'your' user account. If the visitor is not logged in, they are presented with the login panel when they visit the Your Account module page. From here they can enter their nickname and password to log in, or click the New User Registration link to register a new user account, as we did. For visitors that have forgotten their password, clicking on the Lost your Password? link will take them to a screen where they can enter their nickname, and an email will be sent to their registered email address containing a confirmation code, a random-looking 10 digit string; with this code they can have their password changed. A new, random password is generated and emailed to them. PHP-Nuke never stores raw passwords in its database, so it can never reveal any password. With the new password, the user can log in and change their password to something easier to remember. The registration process for the user is straightforward; they only require a nickname, a valid email address, and a password. There are certain rules, however, that are followed by PHP-Nuke: Only one occurrence of an email address is allowed on the system; if someone uses an email address that belongs to another user account that address will be rejected, and the user will have to choose another. Only one occurrence of a particular nickname is allowed as well; the system will check the uniqueness of the nickname before creating the account. After the visitor clicks Finish on the final step, the user account is created. Following that, the confirmation email is sent to the email address. If the email address specified is invalid, or not the visitor's email address, then that visitor will have to create their account with a new email address. If the user doesn't mind being embarrassed, they can contact the site administrator, or wait 24 hours for the account to be deleted from the list of 'waiting to be activated' accounts, and then try again. You will notice that the link to activate the account contains the URL of your PHP-Nuke site: http://thedinosaurportal.com/modules.php?name=Your_Account&op=activate&use rname=userdude&check_num=64ad845758d7f8f572b12800f60842ba It is very important that you have configured your Site URL option correctly in the Web Site Configuration menu (we saw this in Aritcle 4). If you haven't done that, then the activation link will point to the wrong site! The check_num part of the URL is what identifies the unregistered visitor to the system. When the visitor registers his details, PHP-Nuke stores them in the database along with the check_num value. When the visitor visits the above link, PHP-Nuke will check the value of check_num against the values stored in the database, and if it finds a match, it will move that visitor's details to the proper users table in the database, and remove them from the table of visitors waiting to confirm their registration. That's all there is to creating user accounts. It is possible to turn off the registration, so that only the administrator can create accounts. If you feel the need for this, you can read more about it in the PHP-Nuke HOWTO: http://www.karakas-online.de/EN-Book/disable-registration.html That section of the PHP-Nuke HOWTO also has a number of other user account hacks that you can make use of. Graphical Code for User Registration PHP-Nuke enables you to add a security code to the login or registration pages on the site. The security code is a small graphic with some digits, and is shown under the password fields, along with a textbox for the visitor to type in the digits from the graphic. The point of this device is to prevent automated registrations; without typing the correct digits into the Type Security Code field, the submission will not be accepted. The digits displayed in the image are not part of the page HTML, and the only way for the digits to be read is to actually see them when they are displayed on a monitor. Use of the security code is controlled by a setting in the file config.php in the root of your PHP-Nuke installation. (This was the file in which we made some database settings in Article 2.) The setting to change is the value of the $gfx_chk variable. By default, it looks like this in the file, which means that the security code is not used: $gfx_chk = 0; The config.php file itself has a description of the values for this variable as seen in the table: Value Effect on the Security Code 0 Security code is never used. 1 Security code only appears on the administrators login page (admin.php). 2 Security code only appears on the normal user login page. 3 Security code only appears for new user registrations. 4 Security code appears for user login and new user registrations. Thus to have the security code appear only at the administrator login, you would set $gfx_chk to 1 and then save the config.php file: $gfx_chk = 1; For the graphical code to function properly, the GD extension will need to work properly with PHP on the web server. The GD extension takes care of drawing the graphics, and if this isn't functioning for whatever reason (possibly it's not installed), then the graphic will not be displayed properly, and it will be impossible to determine the security code. In that case, you will have to change the setting in config.php to remove the graphical code. If you are running your site on a web hosting account and the graphical security code is not being displayed when it should, then you should contact your host's technical support to find out if there is a problem with the GD extension. You can tell if the GD extension is installed by using the phpinfo() PHP function. Open a text editor and enter the following code: <?php phpinfo(); ?> Save this file as phpinfo.php in the web server root (xampphtdocs). When you navigate to that page in your browser, a number of PHP settings are displayed, including the status of the GD extension: If you do not see a table like the one above on the page, or if it does not say enabled next to GD Support, then contact your host's technical support. The XAMPP package we install in Appendix A has GD installed and working. Seeing Who's Who Log in to your site as the super user and activate the Members List module (deactivated by default). After activation there will be an additional option available in the Modules block called the Members List module, which provides anyone able to view this module with a list of the registered users: Clicking on the username will bring up a view of that user's profile: This is only a view of the user profile, and it is not an editable form. You will notice the word Forum in the above screenshot. The user profile displayed here is actually the user profile from the Forums module (and note also that the Forums module needs to be activated for this screen to be seen). You will also notice that the name of the site is wrong—it says MySite.com, which is not the value we set for our site name. This is because the Forums module has its own set of configuration settings. We will see how to set these in Article 8. Also note that the Members List module takes information from the Forums module configuration settings. The Forums module is a complete application—phpBB, one of the best pieces of free, open-source forum software around—integrated into PHP-Nuke. One aspect of the integration is the shared user account—the user account you create for the PHP-Nuke site also functions as a user account on the forums. As a user, it is possible to work with your details in two places in PHP-Nuke—from the Your Account module and also from within the Forums module. Although there are two views of information, and two places to edit your details, there is still only one user account. At the moment, the Your Account module offers more user details than are found in the Forums module, such as newsletter subscription information. The integration between the PHP-Nuke user account and the user account for the Forums module has gradually become tighter over the versions of PHP-Nuke, and they are likely to 'converge' further in future versions of PHP-Nuke. Once a user account is created, and the user has logged in, a whole new world opens up to them. The Your Account Module The Your Account module is a visitor's space. The visitor is guided round their space by a graphical navigation bar as seen below: Before we look at each of these links, let's mention what else is on the front page of the Your Account module: My Headlines: The user can view a list of headlines from an RSS news feed of another site. The user can select from one of the headline sites that we saw in the previous article, or enter the URL of the site directly. Broadcast Public Message: The user can enter the text of a public message to be shown to all current visitors of the site. We'll look at this in a moment. These two features are not always displayed; their display is controlled by options in the Web Site Configuration menu that we'll see in a moment. However, the user is always able to see their Last 10 Comments posted and their Last 10 News Submissions on this page. Returning to our discussion of the links in the navigation bar of the Your Account module, we've already seen what the Logout/Exit link does; it logs the visitor out. The Themes link takes the visitor to a page from where they can choose one from the list of themes installed on the site. We'll look at the Comments link in detail in the next article; it leads to options for viewing and posting comments on stories. Note that when you are logged in as the super user, the Your Account module displays another panel called Administration Functions. This panel allows you to modify certain details of that user. We will talk about these in the next article and meet them in their natural context. Editing the User Profile The Your Info link takes the user to their user profile. We saw some of the options here when we looked at creating the user manually. These options are generally for personal details (name, email, and so on), newsletter subscription, private message options, and forum configuration, among others. The options themselves are straightforward. A number of options in the user profile correspond to forum profile options, and don't particularly affect the user outside of the Forums module. After making any changes to a user profile, the Save Changes button needs to be clicked to save these changes. Note that the Save Changes button is not the button at the very bottom of the user details page—the Save Changes button is above the Avatar Control Panel: The button at the bottom of the form is marked Submit , and is only active when the options in the Avatar Control Panel are enabled. The Avatar Control Panel seen at the bottom of the user profile contains an interesting option. An avatar is a small graphic, representing you as an online character. You can choose a graphic from the already existing library by clicking on the Show Gallery button next to the Select Avatar from gallery option: Clicking on this button brings up a selection of little images for the user to choose from. Simply click on the required image and this will be assigned to the user profile: Clicking the Back to Profile link will return you to the Your Info page. The library of images you just saw can be found in the modulesForumsimagesavatarsgallery folder of your PHP-Nuke installation. If you want you can add in more images here, but make sure your image is a GIF file, and that it isn't more than 80 pixels wide or 80 pixels high. Your Account Configuration The Your Home link provides some options for configuring Your Account further: From this panel, the number of news stories displayed on the homepage of the site can be controlled. Remember, this setting only applies to you—and only when you are logged in.
Read more
  • 0
  • 0
  • 8760

article-image-cms-made-simple-16-learning-smarty-basics
Packt
04 Mar 2010
8 min read
Save for later

CMS Made Simple 1.6: Learning Smarty Basics

Packt
04 Mar 2010
8 min read
Working with Smarty Variables Smarty variables are much simpler than complex Smarty plugins. They are placeholders that contain plain information about the actual page ID, page alias, or position of the page in the hierarchy. Some Smarty variables that you are not aware of, are already defined in your template. You do not need to know or remember all of them if you know how you can figure out their names and values. Time for action – getting Smarty variables We are going to get the number of the page in the page hierarchy to integrate this information into the design of the page title. How do we figure out the name of the Smarty variable that contains this information? We can get it from the template as follows: In the admin console, click on Layout | Templates. Open the Business World template for edit and add the plugin {get_template_vars} just before the last tag, as shown in the following code snippet: <!DOCTYPE html> <html> <head> <title>{title} - {sitename}</title> {stylesheet} {metadata} <meta name="description" content="" /> </head> <body> ........... {get_template_vars} </div> </body> </html> Click on Apply and then click on the magnifying glass icon on the top-right corner of the admin console to see the result. It should now look like the following screenshot: What just happened? With the Smarty {get_template_vars} plugin, you displayed all Smarty variables available in your template. In the list of variables on each line, one variable is displayed with its name and its value separated by an equals sign. These values change from page to page. For example, the variable with the name friendly_position contains the position of the page in the page hierarchy. If you navigate to other pages, you will see that the value of this variable is different on every page. How do you add a variable in your template? Smarty variables are enclosed in curly brackets as well, but unlike the Smarty plugins, they have a dollar sign at the beginning. To use the variable friendly_position, you just need to add the following Smarty tag to your template: {$friendly_position} You can delete the {get_template_vars} plugin now. It is helpful for you to see which Smarty variables exist and what values are stored there. You can add this plugin again, when you need to look for another variable. Let us use the information we have learned about Smarty plugins and Smarty variables by combining them both to create a title of the page. Open the template Business World (Layout | Templates)for editing and change the title of the page between the body tags and before the tag {content} shown as follows: <h1><span>{$friendly_position}</span> {title}</h1> Then open Business World Style Sheet for editing (Layout | Stylesheets), and add a CSS style to format the title of the page: h1 span { color: #ffffff; background: #cccccc; padding: 0 5px;} The result of the above formating should look as shown in the following screenshot: You  can use any Smarty variable from the template, except for variables with the value Array(). We will look at these special variables in the following section. Controlling output with the IF function You can create numerous templates for your website and assign different templates to different pages. This is useful if you use layouts with a different number of columns. However, sometimes there is only a tiny difference between the templates, and it is not efficient to create a new template each time you need only slight changes. For example, imagine you would like to display the last editor of the page, as we did with the {last_modified_by}tag. It is a useful piece of information on most pages but we would like to hide it on the contact page. You do not need to create a new template where this tag is not added. For such slight changes, it is better to know how to control the output in the same template with an IF structure. Time for action – displaying tags in dependence of the page We  are going to hide the {last_modified_by} tag on the page Contact Us. However, it has to be still displayed on all other pages. Open the template Business World for editing (Layout | Templates). Add the Smarty IF code around the {last_modified_by…} tag, as shown in the following code snippet: <!DOCTYPE html> <html> <head> <title>{title} - {sitename}</title> {stylesheet} {metadata} <meta name="description" content="" /> </head> <body> <div id="container"> <div id="header"> businessWorld </div> <div id="top-navi"> {menu number_of_levels="1" template="minimal_menu.tpl"} </div> <div id="content"> <h1>{title}</h1> {content} {if $page_alias neq "contact-us"} <p>Last modified by {last_modified_by format= "fullname"}</p> {/if} </div> <div id="sidebar"> {menu start_level="2" template="minimal_menu.tpl"} </div> <div id="footer"> 2009 businessWorld </div> </div> </body> </html> Click on Apply and then click on the magnifying glass icon in the top-right corner of the admin console to see the result. What just happened? The IF code that you have added around the paragraph containing the last modification causes CMS to check the page alias of the displayed page. If the page alias is equal to "contact-us", then everything between the IF structure is not shown, otherwise the information about the last modification is displayed. You have seen from the previous section that CMS knows what page of our website is currently being displayed. This information is stored in the Smarty variable {$page_alias}. With the built-in IF function, you can compare the page alias of the actual page with the page alias of the page Contact Us. If the value of the variable {$page_alias} is NOT equal to contact-us, then everything between the IF tags is displayed. If the page alias is equal to contact-us, then nothing is displayed. In this way, you can control the output of the template depending on the page alias.   The abbreviation neq (meaning not equal) between the variable {$page_alias} and the value contact-us is called a Qualifier. Qualifiers are used to build a logical condition in the IF code. The result of the logical condition can be true or false. If the result of the IF condition is true (and it is true if the page alias IS NOT EQUAL to contact-us), then everything placed in between the IF tags is displayed. If the result of the IF condition is false (and it is only false if the page alias IS EQUAL to contact-us), then everything between the IF tags is suppressed. There are more qualifiers that can be used to build logical conditions in Smarty. Some of them are listed in the following table: The IF structure is a useful tool for handling slight changes in one template depending on the page name or the position in the hierarchy. In the preceding example, you saw that you can use every variable from the template to build a logical condition. Creating navigation template with Smarty loop You can also change the HTML markup of the navigation. Before you can learn this principle, you have to understand some Smarty basics. When we added the top navigation to the website, we used a standard template for the navigation. It displays the navigation as an unordered HTML list. Imagine that you need a kind of footer navigation where all the links from the top navigation are shown. You do not need an unordered HTML list in this case. You just would like to show all links in one line separated by a pipe (|) shown as follows: Our Company | Announcements | History | Team | Photo gallery …… This means that you need a completely different HTML markup for this kind of navigation. The great advantage of CMS Made Simple is the ability to display a template in template. While you can use the main template to define the whole layout for the page, the  HTML markup of the navigation is saved in its own template. This navigation template is just a piece of the HTML code that is added to the main template at the place where the tag {menu} is placed.
Read more
  • 0
  • 0
  • 2099