Blogger has in posting messages to add attachments. These appear only in the stream. But with a little magic, and especially with a little coding and imagination, these attachments can beautify your posts, without being sanctioned by the self-pagination established by Blogger. Thus, you can add a link to a document, mp3, or whatever. From the moment it's a link, you can choose to use it to view the message.
code base
\u0026lt;b: loop values = 'data: post.enclosures' var = 'enclosure'>
code, code and more code.
\u0026lt;/ b: loop>
\u0026lt;b:loop> The tag reads the list of all attachments ( data: post.enclosures ) That is, it reads the internal code once with the link 1, then reread the code again with the inner link # 2 and so on until the last link in the message. Between
\u0026lt;b: loop ... > and \u0026lt;/ b: loop> , we can add code to exploit (s) link (s). Data
1) data: enclosure.url : the link URL
2) data: enclosure.mimeType : MIME Type
These 2 data will allow to maximize functionality attachments.
Example 1: See a list of all attachments
\u0026lt;ul>
\u0026lt;b: loop values = 'data: post.enclosures' var = 'enclosure' >
\u0026lt;li>
\u0026lt;a expr:href='data:enclosure.url'> \u0026lt;data:enclosure.url/> \u0026lt;/ a>
\u0026lt;/ li>
\u0026lt;/ b: loop>
\u0026lt;/ ul>
Little explanation:
The code starts with a tag type "list" (
ul ) that encompasses the entire section. Inside, looping attachment occurs through b: loop . From there, each attachment is placed in the list (li
), which contains: link represented by \u0026lt;a expr:href='data:enclosure.url'> . \u0026lt;data:enclosure.url/> displays the url in text format. Example 2: Display a list of attachments type
\u0026lt;ul>
\u0026lt;b: loop values = 'data: post.enclosures' var =' # & enclosure 39;>
\u0026lt;b:if cond='data:enclosure.mimeType == " Type/MIME "'>
\u0026lt;li>
\u0026lt;a expr:href='data:enclosure.url'> \u0026lt;data:enclosure.url/> \u0026lt;/ a>
\u0026lt;/ li>
\u0026lt;/ b: if>
\u0026lt;/ b: loop>
\u0026lt;/ ul>
Little explanation:
The code is almost identical to Example 1.
I have added a conditional tag (
b: if ) which selects only the links corresponding to the "mimetype" said. (Example: audio / mpeg which corresponds to audio files) All other links with a "mimetype" different, will not be repeated.
Example 3: A gallery of images.
\u0026lt;b:loop values='data:post.enclosures' var='enclosure'>
\u0026lt;b: if cond = 'data: enclosure.mimeType == " image / jpeg " '>
\u0026lt;img expr: src =' data: enclosure.url 'height = "60 " ; width = "120 " style = "float: left;" />
\u0026lt;/ b: if>
\u0026lt;/ b: loop> \u0026lt;div
style="clear:both;"/>
Small explanation:
In this new example, it is to create an image gallery.
The condition is that the "mimetype" link corresponds to an image type jpg (
image / jpeg ). The image tag (img
) takes the URL ( data: enclosure.url ). It also contains some basic elements for formatting. CAD : The dimensions (height
, width, style ). In this example: The image will be 120 pixels wide with a height of 60 pixels.
float: left; can have all the images next to each other. Box Type / MIME
If you insert documents like: jpg, gif, mp3, flv, etc., Blogger will identify and automatically fill in this box.
You can also create your own "mimetype".
Until you follow this form: type of document / format.
Examples: Document / txt page / html, etc..
Where to place the code?
The code is placed in the widget "blog" and can only work within it.
The ideal is to insert above or below the content of the article.
Let the post-header
or post-footer . Examples applied.
Blog connection uses the system on an industrial attachments. In
snooping a bit in the blog, you'll find countless pages with a multitude of links used in many different ways.
Players videos YouTube, Dailymotion, MP3 Player, Picasa RSS gallery, facebook link to see a box like (last week's article;)), etc..
With a little imagination, your blog can become a true media platform.
0 comments:
Post a Comment