Page 1 of 2
New block in the portal
Posted: 3. August 2008 17:30
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?
Re: New block in the portal
Posted: 4. August 2008 09:17
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,
Re: New block in the portal
Posted: 4. August 2008 12:50
by JirkaX
No, I haven't. What am I supposed to do? Only to insert mentioned row to gallery_recent file?
Thanks
Re: New block in the portal
Posted: 4. August 2008 13:28
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):
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.
Re: New block in the portal
Posted: 4. August 2008 14:48
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?
Re: New block in the portal
Posted: 4. August 2008 14:55
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...
Okay, different situation.
Open
portal.php
search:
add in a new line:
Code: Select all
'S_DISPLAY_GALLERY' => ($portal_config['portal_gallery']) ? true : false,
Re: New block in the portal
Posted: 4. August 2008 15:47
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.
Re: New block in the portal
Posted: 4. August 2008 16:04
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?
Re: New block in the portal
Posted: 4. August 2008 16:10
by JirkaX
When I tried to perform recommended sql insert, error below occured.
#1054 - Unknown column 'is_dynamic' in 'field list'
Re: New block in the portal
Posted: 4. August 2008 16:13
by Kevin
Okay, try this:
Code: Select all
INSERT INTO `phpbb_portal_config` (`config_name`,`config_value`) VALUES ('portal_gallery','1');
Re: New block in the portal
Posted: 4. August 2008 16:23
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.
Re: New block in the portal
Posted: 4. August 2008 16:26
by Kevin
And you see in the DB that the value changes correctly?
Re: New block in the portal
Posted: 4. August 2008 17:05
by JirkaX
Yes, it works fine. When block visibility in ACP is set to Yes, value is 1, for No value is 0.
Re: New block in the portal
Posted: 4. August 2008 17:18
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.
Re: New block in the portal
Posted: 4. August 2008 18:07
by JirkaX
Link to portal and to changed files find in PM.