|
Profile
Personal Photo
Rating
Options
Personal Statement
John/Will doesn't have a personal statement currently.
Personal Info
John/Will
CuteHack: Technician
29 years old
Male
Channel Islands
Born April-4-1984
Interests
No Information
Statistics
Joined: 3-July 04
Profile Views: 9,517*
Last Seen: 18th February 2009 - 08:57 PM
Local Time: May 23 2013, 12:08 PM
2,986 posts (1 per day)
Contact Information
random ranter uk
lifeinjersey
No Information
rockely@lycos.co.uk
* Profile views updated each hour
|
Topics
Posts
Comments
Friends
My Content
16 Jun 2005
This is an article by lupocreative and branched off code from Bentheo - I did not write this article to any questions refer it to them members.
This is more a tutorial then a hack since we're trying to integrate a javascript into CuteNews. You might just as well use some other ticker script as many well written javascript can be used to make something beautifull when combined with CuteNews. QUOTE (limecity @ Jun 16 2005, 05:12 AM) Could anyone guide me step by step? I created a new template called ticker. So what do i put inside? Next what I do? How do i call the ticker from my html website? Where should the javascript ticker be in? the template or the site pages? I am lost. OK, it took me a while to get there too, but don't panic! 1. First, log in to your server's CuteNews admin panel - http://yourserver/path/to/cutenews/index.php 2. Click "Options" in the header navigation. 3. Click "Edit Templates". 4. Click "create new template". 5. Create a new template based on HEADLINES with name "ticker" (without quotes) - click "Create Template". 6. Now you need to go and edit that new ticker template. If you click "go back" from that last screen, it will take you back to the Edit Templates screen. In the pull-down, Switch to Template: "ticker" and click "Go". 7. The template editor will switch to the ticker template. In the bottom half of this screen, under "Edit Template Parts", click "Active News" and an editor will show underneath. Type this code into the editor: CODE [link]{title}[/link] - actually add in around 20-30 of the space characters rather than the four you've just added above - trust me, the ticker looks better with a load of spaces after each news item. Also note that you cannot simply use your spacebar to add in spaces - html will only render the first spacebar inserted space, after which you need to specify additional spaces with the ascii code - for a space, that's ampersand n b s p semicolon. 8. Click "Save Changes". Please note that if you go and edit this template ever again, you will need to replace the spaces with the ascii code for spaces. The system automatically converts the ascii code to spacebar inserted spaces when you open the template up in the editor. 9. You're done with all the edits in CuteNews. 10. You now need to insert the javascript into your site pages (NOT CuteNews) where you want the ticker to be shown. Find the point in your html where you want to insert it and paste: CODE <script language="JavaScript1.2"> /* Cross browser Marquee script- © Dynamic Drive (www.dynamicdrive.com) For full source code, 100's more DHTML scripts, and Terms Of Use, visit http://www.dynamicdrive.com Credit MUST stay intact */ //Specify the marquee's width (in pixels) var marqueewidth="400px" //Specify the marquee's height var marqueeheight="20px" //Specify the marquee's marquee speed (larger is faster 1-10) var marqueespeed=2 //configure background color: var marqueebgcolor="#99cc99" //Pause marquee onMousever (0=no. 1=yes)? var pauseit=1 //Specify the marquee's content (don't delete <nobr> tag) //Keep all content on ONE line, and backslash any single quotations (ie: that\'s great): var marqueecontent='<nobr><p><b><?PHP $number = 5; $template = "ticker"; include("cutenews/show_news.php"); ?></b></p></nobr>' ////NO NEED TO EDIT BELOW THIS LINE//////////// marqueespeed=(document.all)? marqueespeed : Math.max(1, marqueespeed-1) //slow speed down by 1 for NS var copyspeed=marqueespeed var pausespeed=(pauseit==0)? copyspeed: 0 var iedom=document.all||document.getElementById if (iedom) document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+marqueecontent+'</span>') var actualwidth='' var cross_marquee, ns_marquee function populate(){ if (iedom){ cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee cross_marquee.style.left=parseInt(marqueewidth)+8+"px" cross_marquee.innerHTML=marqueecontent actualwidth=document.all? temp.offsetWidth : document.getElementById("temp").offsetWidth } else if (document.layers){ ns_marquee=document.ns_marquee.document.ns_marquee2 ns_marquee.left=parseInt(marqueewidth)+8 ns_marquee.document.write(marqueecontent) ns_marquee.document.close() actualwidth=ns_marquee.document.width } lefttime=setInterval("scrollmarquee()",20) } window.onload=populate function scrollmarquee(){ if (iedom){ if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"px" else cross_marquee.style.left=parseInt(marqueewidth)+8+"px" } else if (document.layers){ if (ns_marquee.left>(actualwidth*(-1)+8)) ns_marquee.left-=copyspeed else ns_marquee.left=parseInt(marqueewidth)+8 } } if (iedom||document.layers){ with (document){ document.write('<table border="0" cellspacing="0" cellpadding="0"><td>') if (iedom){ write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">') write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') write('<div id="iemarquee" style="position:absolute;left:0px;top:2px"></div>') write('</div></div>') } else if (document.layers){ write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') write('<layer name="ns_marquee2" left=0px top=2px onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') write('</ilayer>') } document.write('</td></table>') } } </script> 11. Now adjust the settings at the top of the script to suit your site - marqueewidth, marqueeheight, marqueespeed, marqueebgcolor. 12. This is the MOST IMPORTANT thing: check that your entire "var marqueecontent" statement is on ONE line, that's from the start apostrophe to the end apostrophe. It will not work unless it is. 13. In order to adjust the number of headlines shown, you can change "$number = 5" to whatever number you wish. 14. If your CuteNews installation is in a relative directory different to the one shown above in the var marqueecontent example, adjust it appropriately. Eg: ../../path/to/installationdirectory/show_news.php 14. Publish your web page. You MUST preview your site using the http address, not a file address, otherwise the javascript won't render in the browser. 15. Providing none of your headlines contain any apostrophes, it should work just fine. If it still isn't working, and you're sure there's no apostrophes, double check your var marqueecontent statement - it MUST be all on one line and must start and end with a single apostrophe. 16. Once you have got a working ticker, you might need to play with the formatting of the text in the ticker. In my example above, it uses the default paragraph p style set for the page (so if you're using CSS it will inherit from that), and the text is bold. It will also use your default hyperlink a formatting. You may wish to adjust all of that. To change the formatting of the hyperlinks in the ticker, I think you will need to do it within a div tag, as I don't think you can stipulate a class directly in the CuteNews template editor. Add a hyperlink class to your CSS then in the javascript, change the var marqueecontent to: CODE var marqueecontent='<nobr><p><div class="yournewhyperlinkclass"><?PHP $number = 5; $template = "ticker"; include("cutenews/show_news.php"); ?></div></p></nobr>' 17. Similarly, you may need to adjust the padding. In my example above, I stipulate a 2px padding at the top to lower the scrolling text a little. It is stipulated in two places: under the "if (iedom)" argument and "else if (document.layers)" argument toward the bottom of the script. 18. You may wish to add a PHP_SELF element if you want to redirect your visitors to another page. For example, I wanted visitors to land up on html/announcements.php where the CuteNews served news usually resides. To do that, change your var marqueecontent statement to: CODE var marqueecontent='<nobr><p><b><?PHP $PHP_SELF = 'path/to/page.php'; $number = 5; $template = "ticker"; include("cutenews/show_news.php"); ?></b></p></nobr>' Hope this all helps. And once again, it would be wrong of me not to say thanks to Bentheo. He put this together, I have simply made it a bit easier to follow - HOPEFULLY! Simon
2 Feb 2005
I'll do this article to help people, its going to be quite excessive so please try to follow me as best you can (even if your HTML/CSS is not very good, rely on common knowledge for this!):
CSS can work in divs, layers and floats. Floats can be classes, classes can be set as specific widths. So, your float must be left or right, pick one, preferrably left. Your container can be a class (for XHTML validity). You can style this "container" class in CSS, I recommend you do. The first thing you need is your container. This will be your "Box" so you do: CODE <div class="container">text here</div> Inside this container, you will be using the float: left; commands found in CSS, please look them up if you are not very familiar with how they work. Here is your first example: CODE <div class="container"> <php $template="left"; include('show_news.php'); ?> </div> You see i added a specific template here. Let's make that template called "left". If you're done, put everything from the active news subtemplate part inside CODE <div class="left"> active news template code </div> Now for four columns you need to specify the width of each class inside the container. The class "left" will begin to look like this: CODE .left { float: left; width: 25%; // or its best to use 24% sometimes! } CSS is not added in the templates but in the file that contains the CN include code. If you don't know how to add css to a file, google for it as there are different ways to do it and everyone has his own preference. Ok your code as ouputed by the browser should now look like: CODE <div class="container"> <div class="left">news</div> <div class="left">news</div> <div class="left">news</div> <div class="left">news</div> </div> See how there is 4 news and each one is beside another?... Now becuase you have specified a WIDTH in each of the class="left" above when you add a FIFTH news item, it will drop down BELOW the first, a SIXTH will be below the second, a SEVENTH will be below the third and so on so forth. Hope thats KINDA helped you guys out For 4 columns on 5 rows You just need to put $number = "20"; in your cutenews include code!
20 Jan 2005
Name: Show news Over X amount of days/weeks/months/years
Author: John/Will CuteNews Compatibility: 1.3.6 - * (no incompatibility reported yet) Description: Adds the ability to use an additional variable with your CN include code. So post will show for a set amount of time. This is not the same as individual expiration date. Instructions: open shows.inc.php ::::::::::::::::::::::::::::::::::::::::::::::::::: Find: ::::::::::::::::::::::::::::::::::::::::::::::::::: CODE elseif($showed == $number){ break; } } add below: ::::::::::::::::::::::::::::::::::::::::::::::::::: CODE //show news per day hack if (isset($show_from)) { if ((time() - $news_arr[0]) > $show_from * 3600) { break; } } //show news per day hack USEAGE ::::::::::::::::::::::::::::::::::::::::::::::::::: in the cutenews include code use: ::::::::::::::::::::::::::::::::::::::::::::::::::: CODE $show_from = 24; for one day
$show_from = 24 * 7; for one week etc
10 Jan 2005
Name: message when article has no comments
Author: Jetski CuteNews Compatibility: 1.3.6 - * (no incompatibility reported yet) Description: Like the title says. Instructions: 1. Open up shows.inc.php in the inc folder of cutenews for editing and find: CODE //---------------------------------- // Prepare the Comment Pagination //---------------------------------- $prev_next_msg = $template_comments_prev_next; 3. Above the code shown above paste in the code below CODE if(count($individual_comments) < 2){ echo "<div align=\"center\" style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; padding: 5px;\"><b>There are no comments for this entry yet.</b></div>"; } 4. Now save the file and upload to your server or wateva. Note: You can edit the style of the DIV Tag to your needs.
17 Dec 2004
Name: Count all articles in a Category
Author: John/Will CuteNews Compatibility: 1.3.6 - 1.4.1 Description: Do you want a way to show your users how many articles you have in a single or multiple categories ? Thought it was impossible? NOT ANYMORE! Instructions: Post this at the place where you want the output to appear on your site CODE <?php $active_news = file('news/data/news.txt'); $counts = array(); foreach ($active_news as $newsRaw) { $newsProperties = explode('|', $newsRaw); $counts[$newsProperties[6]] += 1; } <---OUTPUTCODE GOES HERE---> ?> Now we'll actually show our article count Replace CODE <---OUTPUTCODE GOES HERE---> For multiple categories: CODE echo ''.($counts[xxx] + $counts[xxx]).' articles present'; For single categories: CODE echo ''.$counts[xxx].' articles present'; Now to dissect the code (My favourite part, drools) CODE $active_news = file('news/data/news.txt'); This tells you the directory your cutenews is (news) the data folder (data) and the news.txt file.... all this line does is read. Be sure that path to CuteNews is correct!. all you need to do, on both the accounts above, is replace "xxx" with the category(ies) numbers of your choice that you want the articles to count. So for example.......If using the multiple category hack..... You choose: Category 1 and Category 5. Category 1 has 4 articles in it Category 5 has 2 articles in it The final value will be 6 articles present because the script counts 4+2=6. For the single category, it counts articles for that category ONLY. |
Last Visitors
Comments
Friends
|
|
Lo-Fi Version | Time is now: 23rd May 2013 - 12:08 PM |