CodeIgniter Forums
Open Blog 1.0.0 released - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forum-22.html)
+--- Thread: Open Blog 1.0.0 released (/thread-14724.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12


Open Blog 1.0.0 released - El Forum - 05-31-2009

[eluser]Namaless[/eluser]
I have writed into CI-Forum the solution for Traslated date, but I have revised and release new version here:

Open "application/helpers/language_helper.php" and add this function:
Code:
function localize_date($db_datetime, $datetime_format = NULL)
{
    // Setup date and time format from options.
    if ( $datetime_format === NULL )
    {
        $formatted_date = strftime('%d %B, %Y', strtotime($db_datetime));
    }
    else
    {
        $formatted_date = strftime($datetime_format, strtotime($db_datetime));
    }
    
    // Load CI and language file.
    $ci =& get_instance();
    $ci->lang->load('calendar');
    
    $search = array(    'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday',
                        'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun',
                        'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December',
                        'Jan', 'Feb', 'Mar', 'Apr', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
                        '1st', '2nd', '3rd', '4th', '5th', '6th', '7th', '8th', '9th', '10th', '11th', '12th', '13th', '14th', '15th', '16th', '17th', '18th', '20th', '21st', '22nd', '23rd', '24th', '25th', '26th', '27th', '28th', '29th', '30th', '31st');
    
    $replace = array(    $ci->lang->line('cal_monday'), $ci->lang->line('cal_tuesday'), $ci->lang->line('cal_wednesday'), $ci->lang->line('cal_thursday'), $ci->lang->line('cal_friday'), $ci->lang->line('cal_saturday'), $ci->lang->line('cal_sunday'),
                        $ci->lang->line('cal_mon'), $ci->lang->line('cal_tue'), $ci->lang->line('cal_wed'), $ci->lang->line('cal_thu'), $ci->lang->line('cal_fri'), $ci->lang->line('cal_sat'), $ci->lang->line('cal_sun'),
                        $ci->lang->line('cal_january'), $ci->lang->line('cal_february'), $ci->lang->line('cal_march'), $ci->lang->line('cal_april'), $ci->lang->line('cal_may'), $ci->lang->line('cal_june'), $ci->lang->line('cal_july'), $ci->lang->line('cal_august'), $ci->lang->line('cal_september'), $ci->lang->line('cal_october'), $ci->lang->line('cal_november'), $ci->lang->line('cal_december'),
                        $ci->lang->line('cal_jan'), $ci->lang->line('cal_feb'), $ci->lang->line('cal_mar'), $ci->lang->line('cal_apr'), $ci->lang->line('cal_jun'), $ci->lang->line('cal_jul'), $ci->lang->line('cal_aug'), $ci->lang->line('cal_sep'), $ci->lang->line('cal_oct'), $ci->lang->line('cal_nov'), $ci->lang->line('cal_dec'),
                        $ci->lang->line('dblog_date_1'), $ci->lang->line('dblog_date_2'), $ci->lang->line('dblog_date_3'), $ci->lang->line('dblog_date_4'), $ci->lang->line('dblog_date_5'), $ci->lang->line('dblog_date_6'), $ci->lang->line('dblog_date_7'), $ci->lang->line('dblog_date_8'), $ci->lang->line('dblog_date_9'), $ci->lang->line('dblog_date_10'), $ci->lang->line('dblog_date_11'), $ci->lang->line('dblog_date_12'), $ci->lang->line('dblog_date_13'), $ci->lang->line('dblog_date_14'), $ci->lang->line('dblog_date_15'), $ci->lang->line('dblog_date_16'), $ci->lang->line('dblog_date_17'), $ci->lang->line('dblog_date_18'), $ci->lang->line('dblog_date_19'), $ci->lang->line('dblog_date_20'), $ci->lang->line('dblog_date_21'), $ci->lang->line('dblog_date_22'), $ci->lang->line('dblog_date_23'), $ci->lang->line('dblog_date_24'), $ci->lang->line('dblog_date_25'), $ci->lang->line('dblog_date_26'), $ci->lang->line('dblog_date_27'), $ci->lang->line('dblog_date_28'), $ci->lang->line('dblog_date_29'), $ci->lang->line('dblog_date_30'), $ci->lang->line('dblog_date_31'));

    return str_replace($search, $replace, $formatted_date);
}

This function get from "dBlog", another blog software writed with CodeIgniter.

And now is very simple to change datetime in your language (if you have added), where found this:
Code:
<?php echo strftime('%d %B, %Y ' . lang('at') . ' %H:%M:%S', strtotime($comment['date'])); ?>

Is simple, change with this:
Code:
<?php echo localize_date($comment['date'], '%d %B, %Y ' . lang('at') . ' %H:%M:%S'); ?>

Or if you want use the standard format:
Code:
<?php echo localize_date($comment['date']); ?>

I like this method, please add into the core the possible to traslate date Smile


Open Blog 1.0.0 released - El Forum - 05-31-2009

[eluser]davidbehler[/eluser]
I use datetime for fields in database and use the date_format MYSQL function to format the date the way I want it.

I created the function you posted to translate the formatted date into whatever language I see fit. That's something I needed as MYSQL only returns dates containing english strings but I provide support for multiple languages in my blogging software.


Open Blog 1.0.0 released - El Forum - 05-31-2009

[eluser]Namaless[/eluser]
[quote author="waldmeister" date="1243789583"]I use datetime for fields in database and use the date_format MYSQL function to format the date the way I want it.

I created the function you posted to translate the formatted date into whatever language I see fit. That's something I needed as MYSQL only returns dates containing english strings but I provide support for multiple languages in my blogging software.[/quote]

I don't know the motivation for use this datetime format, but I found only this solution thanks to you! Smile

Another problem I have for May, I use long term ('mayl' in calendar lang) but with your function get always "Mag" and not "Maggio", convert 'may' to 'mayl' for me, but search another good solution about this problem Smile


Open Blog 1.0.0 released - El Forum - 06-05-2009

[eluser]jbawarren[/eluser]
KAMI! Thank you for this system! This is truly a remarkable addition to the forum, Codeigniter, and the PHP community at large. I'm learning a lot just by evaluating your code. Lots of fun! Thanks!


Open Blog 1.0.0 released - El Forum - 06-05-2009

[eluser]NachoF[/eluser]
Wow, I was considering learning Expression Engine or Drupal or something for a project Ill be doing for free for my school but this might just be all I need... it really is impressive... one question, though... is it possible to have users with different privileges?? I want users to just be able to post on certain categories... without the ability to alter settings or post on categories different than what they should... not delete or anything, just post and edit posts on their own category


Open Blog 1.0.0 released - El Forum - 06-07-2009

[eluser]Kami_[/eluser]
[quote author="jbawarren" date="1244270809"]KAMI! Thank you for this system! This is truly a remarkable addition to the forum, Codeigniter, and the PHP community at large. I'm learning a lot just by evaluating your code. Lots of fun! Thanks![/quote]

No problem, I'm glad you like it.

[quote author="NachoF" date="1244278962"]Wow, I was considering learning Expression Engine or Drupal or something for a project Ill be doing for free for my school but this might just be all I need... it really is impressive... one question, though... is it possible to have users with different privileges?? I want users to just be able to post on certain categories... without the ability to alter settings or post on categories different than what they should... not delete or anything, just post and edit posts on their own category[/quote]

Sorry, currently there are only two user level - "normal" user and administrator.


Open Blog 1.0.0 released - El Forum - 09-17-2009

[eluser]Unknown[/eluser]
hmm... i'm still new in codeigniter and i have this problem.
i tried to integrate CI and xajax running application to openblog and find it difficult when it comes to integrating fpdf for my reports.. i always comes with this error (fpdf error: could not include font metric file). i don't know what went wrong.

here is my code:

in controller file
Code:
$this->load->library('fpdf');
define('FPDF_FONTPATH',$this->config->item('fonts_path'));
$this->fpdf->Open();
$this->fpdf->AddPage();
$this->fpdf->SetFont('Arial','B',14);
$this->fpdf->SetY(30);
$this->fpdf->Cell(40,10,'Hello World!');
$this->fpdf->Output('output.pdf','D');

in config file
Code:
$config['fonts_path']= "http://127.0.0.1/mysystem/font";

i tried to use init_fpdf.php but the same thing happens when i delete the file..

please help me out..

thanks and God bless


Open Blog 1.0.0 released - El Forum - 09-17-2009

[eluser]vasocreta[/eluser]
took a look at this Demo. This is very clean and nice for a website. I think I am going to give this whirl. Great job! Thank you.


Open Blog 1.0.0 released - El Forum - 09-18-2009

[eluser]seanloving[/eluser]
Is Open Blog right for me if I want to add a blog to my existing website? What should I know? What should I expect? What should I think about? Thanks in advance.
--Sean Loving


Open Blog 1.0.0 released - El Forum - 09-26-2009

[eluser]luffy[/eluser]
How can you use $this->blog->func() instead of $this->blog_model->func()

If I use $this->blog->func() in my project, it shows that
Unable to locate the model you have specified: blog