⌈⌋ ⎇ branch:  freshcode


Check-in [f894e408bc]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Copy current sidebar setup of //freshcode.club
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | 0.4
Files: files | file ages | folders
SHA1: f894e408bcc22b7ed4cb6b7bb3d3bc785a6ee738
User & Date: mario 2014-07-08 09:30:23
Context
2014-07-09
02:32
Commercial script directories removed. check-in: 6ca8237bad user: mario tags: trunk
2014-07-08
09:30
Copy current sidebar setup of //freshcode.club check-in: f894e408bc user: mario tags: trunk, 0.4
09:27
Introduce ./template/ check-in: 2b7a3bb2bb user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added cron.daily/news_feeds.php.



























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
 * title: Article feeds
 * description: Queries a few online resources for article links
 * version: 0.1
 *
 * Currently populates:
 *   → ./template/feed.linuxcom.htm
 *   → ./template/feed.reddit.htm
 *
 * Both are just copied by template/sidebar_index.php for the
 * frontpage.
 *
 */


// switch to webroot
chdir(dirname(__DIR__));


#-- RSS
$feeds = array(
    "reddit" => "http://www.reddit.com/r/linux/.rss",
    "linuxcom" => "http://www.linux.com/news/software?format=feed&type=rss",
);


#-- Traverse and collect entries
foreach ($feeds as $name=>$url) {

    // data
    $html = "";
    $x = simplexml_load_file($url);
    
    // append
    foreach ($x->channel->item as $item) {
        $html .='<a href="' . htmlspecialchars($item->link)
              . '">' . htmlspecialchars($item->title) . '</a>'
              . "\n";
    }
    
    // save
    file_put_contents("./template/feed.$name.htm", $html);

}

Added template/sidebar_index.php.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15


 <aside id=sidebar>

    <section class="article-links untrimmed">
        <h5>linux.com Software</h5>
        <?php  include("template/feed.linuxcom.htm");  ?>
    </section>

    <section class="article-links trimmed">
        <h5>reddit /r/linux</h5>
        <?php  include("template/feed.reddit.htm");  ?>
    </section>

 </aside>