New block in the portal

Current Version: 1.0.6
Released: 09.01.10
Forum rules
Before creating a new support thread, please take a look in the board3 Portal FAQ and use the search!
Many questions have already been answered.

Topic author
JirkaX
Translator
Posts: 67
Joined: 19. April 2008 14:47

New block in the portal

Post by JirkaX »

Hi, I have question regarding adding new block to the portal page.
I inserted in the acp_portal.php file this row:

Code: Select all

'portal_gallery'				=> array('lang' => 'PORTAL_GALLERY'	, 'validate' => 'bool'	, 'type' => 'radio:yes_no'	, 'explain' => true),
I inserted translation to the launguage files.

I also inserted rows below in the portal_body.html:

Code: Select all

		<!-- IF S_DISPLAY_GALLERY -->
		  <!-- INCLUDE gallery_recent_body.html -->
		<!-- ENDIF -->
But it doesn't wok. Without If tags block is displayed, but with them it is not although in acp I set it On.

Could anyone help me?
User avatar

Kevin
Site Admin
Posts: 2989
Joined: 7. January 2006 20:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg
Contact:

Re: New block in the portal

Post by Kevin »

JirkaX wrote:Without If tags block is displayed, but with them it is not although in acp I set it On.
Have you defined a DB switch for it and added it to your gallery_recent.php?
Something like:

Code: Select all

// Assign specific vars
'S_DISPLAY_GALLERY'	=> ($portal_config['portal_display_gallery']) ? true : false,
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!

Topic author
JirkaX
Translator
Posts: 67
Joined: 19. April 2008 14:47

Re: New block in the portal

Post by JirkaX »

No, I haven't. What am I supposed to do? Only to insert mentioned row to gallery_recent file?
Thanks
User avatar

Kevin
Site Admin
Posts: 2989
Joined: 7. January 2006 20:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg
Contact:

Re: New block in the portal

Post by Kevin »

Don't know what you've done already.
Seems like you've added a DB field named "portal_gallery" - to the phpbb_portal_config table? If not - do so.
Then you have to add this line in your gallery_recent file:
search (if present):

Code: Select all

 // Assign specific vars
add after:

Code: Select all

'S_DISPLAY_GALLERY'   => ($portal_config['portal_gallery']) ? true : false,
To explain it:
You set a value via the ACP to define whether this block is active or not - in the DB field portal_gallery.
This is what you're doing here:

Code: Select all

    'portal_gallery'            => array('lang' => 'PORTAL_GALLERY'   , 'validate' => 'bool'   , 'type' => 'radio:yes_no'   , 'explain' => true),
Then your gallery_recent.php file have to check this DB field portal_gallery if this block is active / if it should be displayed. In this case the switch S_DISPLAY_GALLERY will be set to "true" - otherwise it'll be set to "false".
Then this switch / value is given to the templates, to answer this IF-statement: <!-- IF S_DISPLAY_GALLERY -->
That's all. ;)
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!

Topic author
JirkaX
Translator
Posts: 67
Joined: 19. April 2008 14:47

Re: New block in the portal

Post by JirkaX »

Thanks for the explanation. Problem is that there is no any gallery_recent.php file, there is only html file (gallery_recent_body.html) which is supposed to be included in the portal page. So where should I insert row you recommended?
User avatar

Kevin
Site Admin
Posts: 2989
Joined: 7. January 2006 20:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg
Contact:

Re: New block in the portal

Post by Kevin »

JirkaX wrote:Problem is that there is no any gallery_recent.php file, there is only html file (gallery_recent_body.html)
This information would have been nice in a earlier stage of this thread... :roll:
Okay, different situation.

Open portal.php

search:

Code: Select all

$template->assign_vars(array(
add in a new line:

Code: Select all

    'S_DISPLAY_GALLERY'   => ($portal_config['portal_gallery']) ? true : false,
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!

Topic author
JirkaX
Translator
Posts: 67
Joined: 19. April 2008 14:47

Re: New block in the portal

Post by JirkaX »

Sorry for confusion.
I followed your description but although block is set to On in ACP, nothing is displayed. I checked database and in phpbb_portal_config there is row called portal_gallery with value [BLOB - 1 Byte], so it should be ok.
User avatar

Kevin
Site Admin
Posts: 2989
Joined: 7. January 2006 20:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg
Contact:

Re: New block in the portal

Post by Kevin »

The value should be "text".
The query to use should look like this (mysql):

Code: Select all

INSERT INTO `phpbb_portal_config` (`config_name`,`config_value`,`is_dynamic`) VALUES ('portal_gallery','1','0');
Delete the old entry and create it new.

The ACP switch works without any problems?
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!

Topic author
JirkaX
Translator
Posts: 67
Joined: 19. April 2008 14:47

Re: New block in the portal

Post by JirkaX »

When I tried to perform recommended sql insert, error below occured.

#1054 - Unknown column 'is_dynamic' in 'field list'
User avatar

Kevin
Site Admin
Posts: 2989
Joined: 7. January 2006 20:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg
Contact:

Re: New block in the portal

Post by Kevin »

Okay, try this:

Code: Select all

    INSERT INTO `phpbb_portal_config` (`config_name`,`config_value`) VALUES ('portal_gallery','1');
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!

Topic author
JirkaX
Translator
Posts: 67
Joined: 19. April 2008 14:47

Re: New block in the portal

Post by JirkaX »

This one works, but although I set it On in the ACP, block doesn't appear. radio button in ACP works fine and remembers value which was set correctly.
User avatar

Kevin
Site Admin
Posts: 2989
Joined: 7. January 2006 20:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg
Contact:

Re: New block in the portal

Post by Kevin »

And you see in the DB that the value changes correctly?
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!

Topic author
JirkaX
Translator
Posts: 67
Joined: 19. April 2008 14:47

Re: New block in the portal

Post by JirkaX »

Yes, it works fine. When block visibility in ACP is set to Yes, value is 1, for No value is 0.
User avatar

Kevin
Site Admin
Posts: 2989
Joined: 7. January 2006 20:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg
Contact:

Re: New block in the portal

Post by Kevin »

Good, the DB thing seems to work.
Please give me a link to your forum. And link to *.txt files with the content of all your modified files.
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!

Topic author
JirkaX
Translator
Posts: 67
Joined: 19. April 2008 14:47

Re: New block in the portal

Post by JirkaX »

Link to portal and to changed files find in PM.
Locked

Return to “board3 Portal 1.0.x - English Support”