SimplePortal

Customization => Custom Coding => Topic started by: processor on January 10, 2014, 12:56:28 PM

Title: Customizing Articles Block
Post by: processor on January 10, 2014, 12:56:28 PM
I am wondering where are select options for article portal block defined, in which files i mean? i've been looking like crazy, can't find it.

Code: [Select]
$block_parameter=> array(
                'images'=> 'select'
)

where are those select options ( 1) nothing, 2) category images 3)avatar images ) text strings defined, in which file?
Title: Re: Customizing Articles Block
Post by: [SiNaN] on January 10, 2014, 01:21:05 PM
Hello and welcome to SimplePortal!

All language strings are defined in language files found in Themes/default/languages directory. Those particular strings are in SPortalAdmin.english.php file, the following line:

Code: [Select]
$txt['sp_param_sp_articles_image_options'] = 'None|Poster Avatar|Category Image';
Title: Re: Customizing Articles Block
Post by: processor on January 10, 2014, 02:33:04 PM
Hello and welcome to SimplePortal!

All language strings are defined in language files found in Themes/default/languages directory. Those particular strings are in SPortalAdmin.english.php file, the following line:

Code: [Select]
$txt['sp_param_sp_articles_image_options'] = 'None|Poster Avatar|Category Image';

I have no idea how i missed it, i thought i searched all portal language files for that. Well thanks a bunch Sinan :) and thanks for welcome, love the portal!

I just had to readjust it to look more like a news portal rather than blog style so i customized your already built in article block to display articles as they are displayed by default in article.template.php rather than the prior post link + avatar + category image layout.
So now my article blocks nicely show article excerpts with text nicely sorted by categories where and how i want it.



Let me ask you one more thing. I use sp-s image resize, but, if smf setting to resize images is set then simpleportals image resize isn't working. I guess he just looks for the [img] bbc, but if the tag has width setting due to smf resize, then simple portal doesn't recognizes it. Also the whole resize is a bit meh because then you have to load all the pictures. I guess best solution would be to code articles to recognize first images in post and create a thumbnail to be displayed in article blocks and default display. Anyway, is there any solution for sp not recognizing img bbc if it has width/height resize from smf already?
Title: Re: Customizing Articles Block
Post by: processor on January 10, 2014, 02:43:57 PM
Hello and welcome to SimplePortal!

All language strings are defined in language files found in Themes/default/languages directory. Those particular strings are in SPortalAdmin.english.php file, the following line:

Code: [Select]
$txt['sp_param_sp_articles_image_options'] = 'None|Poster Avatar|Category Image';

oh and btw

Code: [Select]
$block_parameter=> array(
                'images'=> 'select'
)

I see where the text strings are now. But where is the select array defined with it's keys etc?
Title: Re: Customizing Articles Block
Post by: [SiNaN] on January 10, 2014, 02:44:53 PM
The following change should make it work, however I'm not sure if the result would be what you exactly want:

Code: (Find) [Select]
$row['body'] = preg_replace('~class="bbc_img~i', 'class="bbc_img sp_article', $row['body']);
Code: (Replace) [Select]
$row['body'] = preg_replace('~class="bbc_img( resized)?~i', 'class="bbc_img sp_article', $row['body']);
Title: Re: Customizing Articles Block
Post by: [SiNaN] on January 10, 2014, 02:48:05 PM
oh and btw

Code: [Select]
$block_parameter=> array(
                'images'=> 'select'
)

I see where the text strings are now. But where is the select array defined with it's keys etc?

We just explode the text string. So if you had the following text string:

Code: [Select]
$txt['sp_param_sp_articles_image_options'] = 'None|Poster Avatar|Category Image|Custom Item';
the select array would be the following:

Code: [Select]
0 => 'None',
1 => 'Poster Avatar',
2 => 'Category Image',
3 => 'Custom Item',
Title: Re: Customizing Articles Block
Post by: processor on January 10, 2014, 02:50:25 PM
Code: [Select]
$txt['sp_param_sp_articles_image_options'] = 'None|Poster Avatar|Category Image|Custom Item';
the select array would be the following:

Code: [Select]
0 => 'None',
1 => 'Poster Avatar',
2 => 'Category Image',
3 => 'Custom Item',

Ah genius. You helped me a lot, and i like the logic behind smf and sp. Both are great products!
Title: Re: Customizing Articles Block
Post by: [SiNaN] on January 10, 2014, 03:03:54 PM
I've learned everything I know from reading SMF code, so they are pretty much alike; "simple" with one word.

So anything else I can help with?
Title: Re: Customizing Articles Block
Post by: processor on January 10, 2014, 03:27:19 PM
I've learned everything I know from reading SMF code, so they are pretty much alike; "simple" with one word.

So anything else I can help with?

I think there's going to be few more things but as time goes i'll ask, this all solved what was bugging me. Yeah i'm in process of learning source code of both, it's going well.
Title: Re: Customizing Articles Block
Post by: [SiNaN] on January 10, 2014, 03:29:25 PM
Sure, just create a new topic and I'll see if I can be of any help. ;)
Title: Re: Customizing Articles Block
Post by: processor on January 30, 2014, 09:43:52 AM
oh and btw

Code: [Select]
$block_parameter=> array(
                'images'=> 'select'
)

I see where the text strings are now. But where is the select array defined with it's keys etc?


We just explode the text string. So if you had the following text string:

Code: [Select]
$txt['sp_param_sp_articles_image_options'] = 'None|Poster Avatar|Category Image|Custom Item';
the select array would be the following:

Code: [Select]
0 => 'None',
1 => 'Poster Avatar',
2 => 'Category Image',
3 => 'Custom Item',

Where is it stated, in which file, that

  'images'=> 'select' block parameter is $txt['sp_param_sp_articles_image_options'] ?
Title: Re: Customizing Articles Block
Post by: processor on February 14, 2014, 04:39:00 AM
Where is it stated, in which file, that

  'images'=> 'select' block parameter is $txt['sp_param_sp_articles_image_options'] ?
Title: Re: Customizing Articles Block
Post by: [SiNaN] on February 17, 2014, 05:19:38 AM
That's in Themes/default/languages/SPortalAdmin.template.php file.
SimplePortal 2.3.8 © 2008-2024, SimplePortal