Using JavaScript to add your Twitter timeline to a Cotonti-powered website is an easy and simple job even for a HTML rookie. The whole thing will take you around 15 minutes and will require nothing more than some simple operations with you theme/skin.
First off, we need to:
For the testing purposes I chose TwitterJS:
1 |
< script src = "<a href=" http://twitterjs.googlecode.com/svn/trunk/src/twitter.min.js" rel = "nofollow" >http://twitterjs.googlecode.com/svn/trunk/src/twitter.min.js</ a >" type="text/javascript"></ script > |
This string shall be added to the header.tpl within the head block.
Basically, there are 2 parameters: twits div ID and the output settings:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
getTwitters( 'myTwits' , { id: 'cotonti' , count: 5, clearContents: true , enableLinks: true , ignoreReplies: false , withFriends: false , template: '%text%' , prefix: '' , timeout: '10' , onTimeout: '' , onTimeoutCancel: false , newwindow: false , callback: '' }); |
Brief explanation of the settings:
Template variables shall be wrapped in %'s. These are pretty much self-explanatory:
This should look like:
1 2 3 4 |
< div id = "myTwits" > < p >Loading twits < img src = "./skins/{PHP.skin}/images/indicator.gif" /></ p > < p >Use < a href = "<a href=" http://twitter.com/cotonti" rel = "nofollow" >http://twitter.com/cotonti</ a >">this link</ a > to read my twits</ p > </ div > |
Unless you used the template setting, the output HTML-code should be:
1 2 3 4 5 6 7 8 9 10 |
< div id = "myTwits" > < ul > < li > < span class = "twitterPrefix" >I said: </ span > < span class = "twitterStatus" >Join up with our discussions at cotonti.com!</ span > < span class = "twitterTime" >20 minutes ago</ span > </ li > ... </ ul > </ div > |
Use this pattern to define styles for your Twitter timeline.
Поблагодарили: 217 раз
Добавляем твиты на сайт под управлением Котонти
Поблагодарили: 76 раз
Or you can use my free twitter plugin http://littledev.ru/news/cotonti/cotontifolio/twitter-bot.html
Tottaly customizible templates + auto add twits on new pages