Classifieds -MOD Block


Topic author
playagiron
Active Member
Posts: 29
Joined: 4. July 2011 11:23

Classifieds -MOD Block

Post by playagiron »

Hi,

is there any chance to include a block with a random or recent Ad from the Classified Mod? http://www.phpbb.com/community/viewtopi ... &t=2097006
As it works on the index page, it should be fairly easy to implement as a module for Portal 2.0.0, just I don't yet fully grasp how the module creation works, would be great IMHO!

Topic author
playagiron
Active Member
Posts: 29
Joined: 4. July 2011 11:23

Re: Classifieds -MOD Block

Post by playagiron »

Noone using the Classified Mod?
the new version 1.1.0 is great but I tried several times to develop a custom block without success ;-(
User avatar

Michel_61
Portal Enthusiast
Posts: 132
Joined: 14. September 2008 16:06
Location: CH-4206 Seewen
Contact:

Re: Classifieds -MOD Block

Post by Michel_61 »

Hello,

i have found here: https://www.phpbb.de/community/viewtopic.php?t=217284 and have make it into my Forum.

Functionally is o.k.

Sorry my english, its from my scooltime early 35 years :oops:
Aller Anfang ist schwierig, mitunter gehts spielend :-))
http://www.fj-europatreff.eu mit phpbb3 und board3portal
User avatar

Kirk
Dev
Posts: 1953
Joined: 27. July 2010 18:02
phpBB.de User: Kirk
Contact:

Re: Classifieds -MOD Block

Post by Kirk »

Hallo
Ich glaube ich habe s soweit hin bekommen
Ihr müst in der Sprachdatei des classifieds Mods folgendes hinzufügen:
Öffne die Datei root/language/de/mods/classified.php suche dort nach:

Code: Select all

'CL_PHONE'                  => 'Telefonnummer',
setze danach in eine neuen Zeile das hier ein:

Code: Select all

    'CL_PRICE'                  => 'Preis',
	'CL_BY'                     => 'von',
Achtet auf die richtige Kodierung!

1.
Erstellt eine Datei Namens portal_classifieds_mod.php mit folgenden Inhalt:

Code: Select all

<?php
/**
*
* @package - Board3portal v2 Classifieds Mod Modul
* @copyright (c) Board3 Group ( www.board3.de )
* @copyright (c) 2011 Kirk http://www.quad-atv-freunde-wunsiedel.de/ 
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

/**
* @package Board online Date
*/
class portal_classifieds_mod_module
{
	/**
	* Allowed columns: Just sum up your options (Exp: left + right = 10)
	* top		1
	* left		2
	* center	4
	* right		8
	* bottom	16
	*/
	public $columns = 21;

	/**
	* Default modulename
	*/
	public $name = 'PORTAL_CLASSIFIEDS_MOD';

	/**
	* Default module-image:
	* file must be in "{T_THEME_PATH}/images/portal/"
	*/
	public $image_src = '';

	/**
	* module-language file
	* file must be in "language/{$user->lang}/mods/portal/"
	*/
	public $language = 'portal_classifieds_mod_module';
	
	/**
	* custom acp template
	* file must be in "adm/style/portal/"
	*/
	public $custom_acp_tpl = '';
	
		/**
	* hide module name in ACP configuration page
	*/
	public $hide_name = false;

	
	public function get_template_center($module_id)
	{
		global $config, $template, $user, $phpEx, $phpbb_root_path, $auth;

// MOD :: CLASSIFIEDS MOD -- START
if (isset($config['enable_classifieds']))
{
  if($config['enable_classifieds'] && $auth->acl_get('u_view_classifieds') && ( ($config['display_ads_on_index'] && $config['ad_num_display_on_index'] !='0') || ($config['display_rand_ads_on_index'] && $config['rand_ad_num_display_on_index'] !='0') ) )
  {
    include($phpbb_root_path . CL_DIRECTORY . '/includes/functions_buysell.' . $phpEx);
    
    $user->setup('mods/classified');
  
    if ($config['display_ads_on_index'])
    {
      display_recent_ads($config['ad_num_display_on_index']);
  
      $template->assign_vars(array(
        'S_DISPLAY_ADS_ON_INDEX'	=> true,
        'S_RECENT_ADS_TOP'	=> ($config['recent_ads_place']) ? true : false,
      ));
    }
  
    if ($config['display_rand_ads_on_index'] )
    {
      display_random_ads($config['rand_ad_num_display_on_index']);
  
      $template->assign_vars(array(
        'S_DISPLAY_RAND_ADS_ON_INDEX'	=> true,
        'S_RAND_ADS_TOP'	=> ($config['rand_ads_place']) ? true : false,
      ));
    }
  }
}
// MOD :: CLASSIFIEDS MOD -- END

	return 'portal_classifieds_mod_center.html';
	}


	public function get_template_acp($module_id)
	{
		return array(
			'title'	=> 'PORTAL_CLASSIFIEDS_MOD',
			'vars'	=> array(),
		);
	}

	/**
	* API functions
	*/
	public function install($module_id)
	{
		return true;
	}

	public function uninstall($module_id)
	{
		return true;
	}
}
Diese Datei kommt in das Verzeichniss root/portal/modules

2.
Erstellt eine Datei Namens portal_classifieds_mod_module.php mit folgenden Inhalt:

Code: Select all

<?php
/**
*
* @package - Board3portal v2 Classifieds Mod Modul
* @copyright (c) Board3 Group ( www.board3.de )
* @copyright (c) 2011 Kirk http://www.quad-atv-freunde-wunsiedel.de/ 
* @version 1.1.0
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

/**
* DO NOT CHANGE
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

if (empty($lang) || !is_array($lang))
{
	$lang = array();
}

// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine

$lang = array_merge($lang, array(
	'PORTAL_CLASSIFIEDS_MOD'	        => 'Kleinanzeigen',
));
?>
Achtet beim speichern dieser Datei das es in der Kodierung UFT8 ohne Boom ist.
Diese Datei kommt in das Verzeichniss root/language/de/mods/portal

3.
Für prosilver basierende Styles.
Erstellt eine Datei Namens portal_classifieds_mod_center.php mit folgenden Inhalt:

Code: Select all

{$C_BLOCK_H_L}{$TITLE}{$C_BLOCK_H_R}
	<ul class="topiclist bg1">
            
         <!-- BEGIN rand_ad -->
 		<li><dl>
			<dd style="border-left:0px">
	
           <li class="row bg2 classifieds_block" <p style="margin: 5px 5px 5px 5px;"><!-- IF rand_ad.S_LAST_ROW and rand_ad.S_ROW_COUNT is even -->style="width:100%;"<!-- ENDIF -->
                <dl>
                  <dd>
                      <div class="cl_thumb">
                        <!-- IF rand_ad.THUMB -->
                           <img src="{rand_ad.THUMB}" alt="{rand_ad.TITLE}" />
                        <!-- ELSE -->
                           <img src="{T_THEME_PATH}/images/noimage.gif" alt="{rand_ad.TITLE}" />
                        <!-- ENDIF -->
                     </div>
                     <div class="cl_desc">
                        <a href="{rand_ad.AD_LINK}"><b>{rand_ad.AD_TITLE}</b></a><br />
                        {L_IN} <b>{rand_ad.CATEGORY}</b><br />
                        <b>{L_CL_PRICE}</b>: {rand_ad.AD_PRICE}   <i>{L_CL_BY}</i> {rand_ad.AD_POSTER}
                     </div>
                  </dd>
               </dl>
         </p>   </li>

			</dd>
		</dl></li>
         <!-- END rand_ad -->
      </ul>
   {$C_BLOCK_F_L}{$C_BLOCK_F_R}
Dieses kommt in das Verzeichniss root/styles/prosilver/template/portal/modules

Bei mir werden die Kleinanzeigen untereinander dar gestellt aber das kann am meinen Style liegen
da ich es nicht mit einem org. Style getestet habe.
Gruß Udo

Topic author
playagiron
Active Member
Posts: 29
Joined: 4. July 2011 11:23

Re: Classifieds -MOD Block

Post by playagiron »

Hi,

nice mod!
Is there any difference to the addon https://www.phpbb.de/community/viewtopi ... 7&t=217284?
And can you activate it in the MOD configuration or how is the block activated? Doesnt it need to be somehow in the database as well?

And finally, any chance to make it work in the side column as well?
User avatar

Kirk
Dev
Posts: 1953
Joined: 27. July 2010 18:02
phpBB.de User: Kirk
Contact:

Re: Classifieds -MOD Block

Post by Kirk »

Hello
You can use this module easily in the ACP portal area move.
Once you have the necessary files into the appropriate
Directory have uploaded, you can use this module Add in the ACP portal area.
Here you can download the latest version.
http://www.quad-atv-freunde-wunsiedel.d ... =128&t=712

sorry for my bad English
Gruß Udo

Topic author
playagiron
Active Member
Posts: 29
Joined: 4. July 2011 11:23

Re: Classifieds -MOD Block

Post by playagiron »

Hi Kirk,

nice move!!
This looks very promising.
One small bug: the language folder for english is called "potal" instead of "portal".
And the design looks not correct on my forum, seems some css tweaking will be needed, and in the case of the side maybe a change in the number of showed ads (one).
Image
or does it work for someone else?
And the side bar seems too wide.

but great initiative! kudos!
User avatar

Kirk
Dev
Posts: 1953
Joined: 27. July 2010 18:02
phpBB.de User: Kirk
Contact:

Re: Classifieds -MOD Block

Post by Kirk »

Thanks for the tip "Potal"
The design I'm going to try to adapt.
Gruß Udo
User avatar

Kirk
Dev
Posts: 1953
Joined: 27. July 2010 18:02
phpBB.de User: Kirk
Contact:

Re: Classifieds -MOD Block

Post by Kirk »

Replace the portal_classifieds_mod_center.html with this code.

Code: Select all

{$C_BLOCK_H_L}{$TITLE}{$C_BLOCK_H_R}


       <ul class="topiclist bg1">
  
         <!-- BEGIN rand_ad -->
            <li class="classifieds_block" <!-- IF rand_ad.S_LAST_ROW and rand_ad.S_ROW_COUNT is even --><style="width:100%;"><!-- ENDIF -->
               <dl>
                  <dd>
                       <div class="cl_thumb">
                        <!-- IF rand_ad.THUMB -->
                           <img src="{rand_ad.THUMB}" alt="{rand_ad.TITLE}" />
                        <!-- ELSE -->
                           <img src="{T_THEME_PATH}/images/noimage.gif" alt="{rand_ad.TITLE}" />
                        <!-- ENDIF -->
                     </div>
                     <div class="cl_desc">
                        <a href="{rand_ad.AD_LINK}"><b>{rand_ad.AD_TITLE}</b></a><br />
                        {L_IN} <b>{rand_ad.CATEGORY}</b><br />
                        <b>{L_CL_PRICE}</b>: {rand_ad.AD_PRICE}   <i>{L_CL_BY}</i> {rand_ad.AD_POSTER}
                     </div>
                  </dd>
               </dl>
            </li>
         <!-- END rand_ad -->
      
      </ul>
   {$C_BLOCK_F_L}{$C_BLOCK_F_R}
In IE8, there is unfortunately a bit off-center.
Gruß Udo
User avatar

Kirk
Dev
Posts: 1953
Joined: 27. July 2010 18:02
phpBB.de User: Kirk
Contact:

Re: Classifieds -MOD Block

Post by Kirk »

Update

portal_classifieds_mod_center.html

Code: Select all

{$C_BLOCK_H_L}{$TITLE}{$C_BLOCK_H_R}
<div class="forabg">
         <ul class="topiclist">
      
         <!-- BEGIN rand_ad -->
            <li class="row bg2 classifieds_block" <!-- IF rand_ad.S_LAST_ROW and rand_ad.S_ROW_COUNT is even -->style="width:100%;"<!-- ENDIF -->>
               <dl>
                  <dd>
					   <div class="cl_thumb">
                        <!-- IF rand_ad.THUMB -->
                           <img src="{rand_ad.THUMB}" alt="{rand_ad.TITLE}" />
                        <!-- ELSE -->
                           <img src="{T_THEME_PATH}/images/noimage.gif" alt="{rand_ad.TITLE}" />
                        <!-- ENDIF -->
                     </div>
                     <div class="cl_desc" style="padding: 5px 8px 5px;">
                        <a href="{rand_ad.AD_LINK}"><b>{rand_ad.AD_TITLE}</b></a><br />
                        {L_IN} <b>{rand_ad.CATEGORY}</b><br />
                        <b>{L_CL_PRICE}</b>: {rand_ad.AD_PRICE}   <i>{L_CL_BY}</i> {rand_ad.AD_POSTER}
                     </div>
      </dd>
               </dl>
            </li>
         <!-- END rand_ad -->
      
      </ul>
   </div>   
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
portal_classifieds_mod_side.html

Code: Select all

{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{$IMAGE_SRC}" width="{$IMAGE_WIDTH}" height="{$IMAGE_HEIGHT}" alt="" />&nbsp;<!-- ENDIF -->{$TITLE}{$LR_BLOCK_H_R}
            
         <ul class="topiclist">
            
         <!-- BEGIN rand_ad -->
 		<li><dl>
	
           <li class="row bg2 classifieds_block" style="width:100%;"<!-- IF rand_ad.S_LAST_ROW and rand_ad.S_ROW_COUNT is even --><!-- ENDIF -->
                <dl>
                  <dd>
                      <div class="cl_thumb" style="margin: 0px 0px 1px 2px;">
                        <!-- IF rand_ad.THUMB -->
                           <img src="{rand_ad.THUMB}" alt="{rand_ad.TITLE}" />
                        <!-- ELSE -->
                           <img src="{T_THEME_PATH}/images/noimage.gif" alt="{rand_ad.TITLE}" />
                        <!-- ENDIF -->
                     </div>
                     <div class="cl_desc" style="margin: 1px 0px 1px 70px;">
                        <a href="{rand_ad.AD_LINK}"><b>{rand_ad.AD_TITLE}</b></a><br />
                        {L_IN} <b>{rand_ad.CATEGORY}</b><br />
                        <b>{L_CL_PRICE}</b>: {rand_ad.AD_PRICE}<br />   <i>{L_CL_BY}</i> {rand_ad.AD_POSTER}
                     </div>
                  </dd>
               </dl>
            </li>

		</dl></li>
         <!-- END rand_ad -->
      </ul>
   {$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
Gruß Udo

Topic author
playagiron
Active Member
Posts: 29
Joined: 4. July 2011 11:23

Re: Classifieds -MOD Block

Post by playagiron »

Hi,

works now great for the center one.
But since I updated, I cannot add the side block, is this a general bug or any idea? worked before which is strange.
Seems this mod cen be released otherwise! Great work!
User avatar

Kirk
Dev
Posts: 1953
Joined: 27. July 2010 18:02
phpBB.de User: Kirk
Contact:

Re: Classifieds -MOD Block

Post by Kirk »

I have tested it with version 1.1.0, and the side block without error.
Can you move the center block side?
Gruß Udo

Topic author
playagiron
Active Member
Posts: 29
Joined: 4. July 2011 11:23

Re: Classifieds -MOD Block

Post by playagiron »

Hi,

moving works! Thanks! so I conclude one can not have the block both on the bottom AND at the side? But its perfectly OK, just thought they were kind of independent.

The side version looks now better, but it is still too wide and I wonder whether it would be possible to only have ONE ad there without changeing the general number setting.
But the biggest thing is IMHO the size and layout. Maybe a custom CSS could make the block more look alike with the other Portal Blocks.

Or how does it look in your website ß Do you have a link or screenshot?
On my forum it looks like this:
Image

Anyway, great initiative and value added for board3 fans!!
User avatar

Kirk
Dev
Posts: 1953
Joined: 27. July 2010 18:02
phpBB.de User: Kirk
Contact:

Re: Classifieds -MOD Block

Post by Kirk »

Will you want to have this module at the top or bottom,
You need him in the ACP in the up or down to add block.
These two blocks are independent of the other blocks.
Here are some screenshots:

Classifieds Block up
Classifieds Block center
Classifieds Block side
Classifieds Block down
Gruß Udo

Topic author
playagiron
Active Member
Posts: 29
Joined: 4. July 2011 11:23

Re: Classifieds -MOD Block

Post by playagiron »

Great images thx a lot!

I manage to get all except the SIDE one (see my image in last post) where the width of the column gets far to big.
I checked all code but could not find the CSS/html responsible for the displacement. Apparently it works in your installation (even though I think your right olumn is still a bit wider than the left one, but correct me if Im wrong!)
Thanks a lot!!
Post Reply

Return to “Modification Requests”