SoloCodigo.com

Started by codebirth, 7 years ago

previous topic - next topic

0 Members and 1 Guest are viewing this topic.

codebirth

*
7 years ago
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
7 years ago
Very nice looking site. Well done.

Feline

*
#2
7 years ago
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
7 years ago
 :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
7 years ago
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
7 years ago
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
7 years ago
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
7 years ago
Quote from: feline, 7 years ago
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
7 years ago
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
7 years ago
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
7 years ago
looks nice. How you make the twitter: http://solocodigo.com/tweets/ section.  I like that! O0 O0

codebirth

*
#11
7 years ago
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
8 months ago
Today we update our Forum to the Version 1.45
Feline
11 months ago
Today we update our Forum to Version 1.4
This release is full compatible with the EU GDPR
Feline
a year ago
Update for PortaMx 1.54 ecl released.
With this updates the Portal works with PHP 7.x and SMF 2.0.15
Feline
a year ago
PortaMx Forum 1.3
released !

*
Feline
a year ago
Today we switched to PHP 7.2 and activate Opcode caching.
Fast .. Very fast *
Feline
2 years ago
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
HolidaysMay 27: Memorial Day (en)