SoloCodigo.com

Started by codebirth, 2011 July 22, 08:12:18 am

previous topic - next topic

0 Members and 1 Guest are viewing this topic.

codebirth

*
2011 July 22, 08:12:18 am
After many months waiting for SMF 2.0 Final to be released I finally converted my biggest forum from phpBB3 to SMF 2.0 Final + PortaMX 1.3 last sunday :)

Feel free to take a look at http://solocodigo.com and tell me what you think  O0

Thanks.

c o d e b i r t h
http://codebirth.com/smf

b4pjoe

*
#1
2011 July 22, 10:08:04 am
Very nice looking site. Well done.

Feline

*
#2
2011 July 22, 11:26:41 am
Your template have a lot of html errors ..
and the footer is completely bad, see image.
They have a ul tag but no li tags...


[attachment deleted by admin]
Many are stubborn in relation to the way, but less in relation to the target.

codebirth

*
#3
2011 July 22, 01:41:51 pm
 :P need to check those html errors. Thanks both for the feedback!  O0

c o d e b i r t h
http://codebirth.com/smf

Feline

*
#4
2011 July 22, 11:35:28 pm
Sure .. if you add the li tags in the footer (as in the default theme) the PortaMx copyright is also show below the SMF copyright  ;)
Many are stubborn in relation to the way, but less in relation to the target.

codebirth

*
#5
2011 July 23, 10:32:43 pm
All fixed! Thanks Fel  O0

There's a last little thing I would like to change but I can't find the way. I would like to make the icons in the newposts block a bit smaller, setting the width and height. Is possible to do it?

Edit: Nevermind I found it in Sources/Portamx/Class/newposts.php

[attachment deleted by admin]

c o d e b i r t h
http://codebirth.com/smf

Feline

*
#6
2011 July 24, 07:45:24 pm
It's better (and simpler on update) to do that in the css .
find:
Code Select
h4.catbg_grid img
{
vertical-align: top;
margin-top: 4px;
}

simple add a height to this and adjust the margin-top  ;)
Many are stubborn in relation to the way, but less in relation to the target.

codebirth

*
#7
2011 July 25, 09:10:58 am
Quote from: feline, 2011 July 24, 07:45:24 pm
It's better (and simpler on update) to do that in the css .
find:
Code Select
h4.catbg_grid img
{
vertical-align: top;
margin-top: 4px;
}

simple add a height to this and adjust the margin-top  ;)


Much better, thanks!

c o d e b i r t h
http://codebirth.com/smf

Feline

*
#8
2011 July 25, 10:48:21 am
If you have more themes you can also add this class to the theme css itself.
In this case you have to use:
Code Select

h4.catbg_grid img
{
vertical-align: top !important;
margin-top: 4px !important;
height: ##px;
}

Then the image show in other themes correct  ;)
Many are stubborn in relation to the way, but less in relation to the target.

codebirth

*
#9
2011 July 25, 11:51:43 am
No, I don't use other themes but is good to know  O0

c o d e b i r t h
http://codebirth.com/smf

trench

*
#10
2011 August 11, 03:29:08 am
looks nice. How you make the twitter: http://solocodigo.com/tweets/ section.  I like that! O0 O0

codebirth

*
#11
2011 August 22, 12:30:13 pm
Hi trench, I was on vacation and couldn't reply sooner.

This is the code I use for the tweets section. It's a bit dirty (I admit) but it does all the job in a single file, caching included.

Code Select
<?php

// Config values
$rss = 'http://search.twitter.com/search.atom?q=%23solocodigo';
$cache_time = 2; // in minutes

class Feed
{
private $_id = 0;
private $_rss = '';
private $_current_last_tweet = 0;
private $_last_tweet = '';
private $_tags = array();
private $_exclude_user = array();
private $_exclude_tweet = array();
private $_cache_file = '';
private $_cache_time = 0;


function __construct($feed)
{
$this->_id = $feed['id'];
$this->_rss = $feed['rss'];
$this->_cache_file = $feed['cache_file'];
$this->_cache_time = $feed['cache_time'];
$this->_last_tweet = $feed['last_tweet'];
}

function read()
{
// Check cache
$now = time();
if (!file_exists($this->_cache_file))
{
$file_contents = file_get_contents($this->_rss);
$this->write_cache($file_contents);
}
elseif ($now > (filemtime($this->_cache_file) + ($this->_cache_time * 60)))
{
$file_contents = file_get_contents($this->_rss);
$this->write_cache($file_contents);
}

$rss = simplexml_load_file($this->_cache_file);
if ($rss)
{
$items = $rss->entry;
foreach ($items as $item)
{
$username = substr($item->author->uri, strrpos($item->author->uri, '/') + 1);
$id = substr($item->id, strrpos($item->id, ':') + 1);
if (in_array($username, $this->_exclude_user) || in_array($id, $this->_exclude_tweet))
continue;
$itemRSS = array(
'username' => $username,
'avatar' => $this->getProfileImageUrl($username),
'message' => $item->content,
'id' => $id,
'date' => $item->updated,
);
$this->showTweet($itemRSS);
}
}
}

private function write_cache($file_contents)
{
file_put_contents($this->_cache_file, $file_contents);
}

private function getProfileImageUrl($username)
{
$image = 'http://img.tweetimag.es/i/'.$username.'_n';
return $image;
}

private function showTweet($tweet)
{
// Es un poco guarro hacer esto aquí pero así no me complico
echo '
<div style="border-top: solid 1px #f0f0f0;">
<div style="float:left; height: 56px; padding: 15px 13px 13px 10px; width:50px;">
<a href="http://twitter.com/'.$tweet['username'].'" target="_blank"><img src="'.$tweet['avatar'].'" height="48" width="48" border="0"></a>
</div>
<div style="padding: 13px;">
<a class="tweet_username" href="http://twitter.com/'.$tweet['username'].'" target="_blank">'.$tweet['username'].'</a> <span class="tweet_message">'.$tweet['message'].'</span><br />
<a class="tweet_time_ago" href="http://twitter.com/'.$tweet['username'].'/status/'.$tweet['id'].'" target="_blank">hace '.$this->time_ago($tweet['date'], 1).'</a>
<a class="tweet_retweet" target="_blank" href="http://twitter.com/home?status='.rawurlencode(strip_tags("RT @".$tweet['username']." ".$tweet['message'])).'">Retwittear</a>
<a class="tweet_reply" target="_blank" href="http://twitter.com/home?status='.rawurlencode("@".$tweet['username']." ").'">Responder</a>
</div>
<div style="clear: both"></div>
</div>';
}

private function time_ago($date, $granularity=2)
{
$date = strtotime($date);
$difference = time() - $date;
$periods = array('década' => 315360000,
'año' => 31536000,
'mes' => 2628000,
'semana' => 604800,
'día' => 86400,
'hora' => 3600,
'minuto' => 60,
'segundo' => 1);

foreach ($periods as $key => $value) {
if ($difference >= $value) {
$time = floor($difference/$value);
$difference %= $value;
$retval .= ($retval ? ' ' : '').$time.' ';
$retval .= (($time > 1) ? (($key=='mes')?$key.'es':$key.'s') : $key);
$granularity--;
}
if ($granularity == '0') { break; }
}
return $retval;
}
}

//Set the banning active
$ssi_ban = true;

//Path to SSI.php
require(dirname(__FILE__) . '/../SSI.php');

//Page title. This will appear in the browser
$context['page_title_html_safe'] = 'Tweets';

// Oculto los paneles laterales de PortaMx
$context['pmx']['show_leftpanel'] = false;
$context['pmx']['show_rightpanel'] = false;
$context['pmx']['show_footpanel'] = false;

//This is self explanatory
template_header();

echo '
<style type="text/css">
a.tweet_username {
color: #2276BB;
font-family: Calibri, Tahoma, "Trebuchet MS", sans-serif;
font-size: 13px;
font-weight: bold;
text-decoration: none;
}
a.tweet_username: hover {
text-decoration: underline;
}
.tweet_message {
font-family: Calibri, Tahoma, "Trebuchet MS", sans-serif;
font-size: 13px;
}
a.tweet_hashtag {
color: #2276BB;
text-decoration: none;
}
a.tweet_hashtag:hover {
text-decoration: underline;
}
a.tweet_mention {
color: #2276BB;
text-decoration: none;
}
a.tweet_mention:hover {
text-decoration: underline;
}
a.tag {
color: #2276BB;
text-decoration: none;
}
a.tag:hover {
text-decoration: underline;
}
a.tweet_time_ago {
color: #888888;
font-size: 11px;
text-decoration: none;
}
a.tweet_time_ago:hover {
color: #2276BB;
text-decoration: underline;
}
a.tweet_retweet {
color: #2276BB;
font-size: 11px;
text-decoration: none;
}
a.tweet_retweet:hover {
text-decoration: underline;
}
a.tweet_reply {
color: #2276BB;
font-size: 11px;
text-decoration: none;
}
a.tweet_reply:hover {
text-decoration: underline;
}
</style>';

//Here we define the link tree
$context['linktree'] = array(
 'href' => $scripturl,
 );

echo '<div style="background: #e0eeef; border: solid 1px #78abaf; margin-bottom: 20px; padding: 5px; text-align:center;">Utiliza el hashtag <b>#solocodigo</b> en tus tweets para que aparezcan en este espacio</div>';

$feed = array(
'id' => 1,
'rss' => $rss,
'last_tweet' => 0,
'cache_file' => $cachedir . '/tweets_'.md5($rss).'.xml',
'cache_time' => $cache_time,
);

$oFeed = new Feed($feed);
$oFeed->read();
unset($oFeed);

//This is self explanatory too.
template_footer();

?>


Just paste the above code in a new file, change the config values and some text strings to fit your needs, save it as index.php and upload it to a new folder (named tweets or whatever you want) inside your SMF root folder.

Hope you find it useful  :)

c o d e b i r t h
http://codebirth.com/smf

* Shouts

Feline
2018 Aug. 21, 08:10:46 pm
Today we update our Forum to the Version 1.45
Feline
2018 Jun. 09, 07:54:13 pm
Today we update our Forum to Version 1.4
This release is full compatible with the EU GDPR
Feline
2018 Mar. 28, 11:56:21 am
Update for PortaMx 1.54 ecl released.
With this updates the Portal works with PHP 7.x and SMF 2.0.15
Feline
2018 Mar. 17, 10:35:03 pm
PortaMx Forum 1.3
released !

*
Feline
2017 Dec. 10, 04:30:54 am
Today we switched to PHP 7.2 and activate Opcode caching.
Fast .. Very fast *
Feline
2017 Mar. 03, 11:54:35 pm
Today we upgrade our old SMF 2.0 Forum to PortaMx Forum *

* Calendar

Su
Mo
Tu
We
Th
Fr
Sa
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
HolidaysDec 16: 3. Advent (de)