SimplePortal

Support => English Support => Topic started by: Eudemon on February 02, 2012, 08:26:47 PM

Title: custom display
Post by: Eudemon on February 02, 2012, 08:26:47 PM
hello, suppose i have a php file in a folder, like /img/example.php
that file uses ssi.php for the whole forum layout
and i want to display sp blocks there, is there any way to add it to custom display option

i can get it displays if i write a custom action to that file, but im just wondering if there is another way
Title: Re: custom display
Post by: Chen Zhen on February 02, 2012, 10:09:20 PM
hello, suppose i have a php file in a folder, like /img/example.php
that file uses ssi.php for the whole forum layout
and i want to display sp blocks there, is there any way to add it to custom display option

i can get it displays if i write a custom action to that file, but im just wondering if there is another way

I'm not entirely sure for custom display options as it is now. It appears to just allow a wavy + action & then idkin + specifics off of that same action.
If its for custom php blocks you can surround the entire code with some logic for the matching url only but you would have to hide body + title... custom action all

I can probably come up with a custom edit for you to have it display while the uri resides at that file if you wish.. using a specific command in the custom action input. Unless Sinan already put something like that for maybe specific url's but the help text does not show that if he did + off hand I've never looked at that part of the code as of yet.

Title: Re: custom display
Post by: Eudemon on February 02, 2012, 11:55:28 PM
Quote
I can probably come up with a custom edit for you to have it display while the uri resides at that file if you wish.. using a specific command in the custom action input. Unless Sinan already put something like that for maybe specific url's but the help text does not show that if he did + off hand I've never looked at that part of the code as of yet.

that's why i'm asking, if there is alrdy by dev team a coded way to display that but wasn't added to the help text
else plz just take a quick look at custom edit, if it is too much trouble i will just make a custom action for it
Title: Re: custom display
Post by: Chen Zhen on February 03, 2012, 01:06:23 AM

File:
Sources -> Subs-Portal.php

find:
Code: [Select]
// Did we disable all blocks for this action?
if (!empty($modSettings['sp_' . $action . 'IntegrationHide']))
return false;

replace with:
Code: [Select]
// Did we disable all blocks for this action?
if (in_array('url=' . $_SERVER['REQUEST_URI'], $display))
return true;
elseif (!empty($modSettings['sp_' . $action . 'IntegrationHide']))
return false;

For the blocks you want to display for that specific url put this into the custom display:
Code: [Select]
url=/img/example.php

.. you use Simple SEF or pretty url's, correct?
I did not test it while using that type of mod & hope the $_SERVER['REQUEST_URI'] reflects what is displayed in the address bar with those .htaccess rewrites.
Title: Re: custom display
Post by: Chen Zhen on February 03, 2012, 01:26:56 AM
Just in case you have an extra directory tree in your main, you can use this as an alternate replacement to the above so you do not have to include that extra directory in the custom display options:

Code: [Select]
// Did we disable all blocks for this action?
global $boardurl;
if (in_array('url=' . str_replace($boardurl, '', rtrim($_SERVER['REQUEST_URL'], "#")), $display))
return true;
elseif (!empty($modSettings['sp_' . $action . 'IntegrationHide']))
return false;
   
Title: Re: custom display
Post by: Eudemon on February 03, 2012, 12:41:10 PM
no i don't use sef or pretty url

and thanks for the code
im at my college right now, i will test it when i get home
Title: Re: custom display
Post by: Eudemon on February 04, 2012, 02:09:06 PM
tested and working, thanks

btw is there anyway to make /img/* to work?
Title: Re: custom display
Post by: Chen Zhen on February 04, 2012, 04:49:14 PM
tested and working, thanks

btw is there anyway to make /img/* to work?

Replacement of original code:
Code: [Select]
// Did we disable all blocks for this action?
global $boardurl;
foreach ($display as $check)
{
if ((substr($check,0,4) == 'url=') && substr((str_replace($boardurl, '', $_SERVER['REQUEST_URL'])), 0, strlen(substr($check,4))) == substr($check,4))
return true;
}

if (!empty($modSettings['sp_' . $action . 'IntegrationHide']))
return false;

Title: Re: custom display
Post by: Eudemon on February 04, 2012, 05:21:01 PM
tested, /img/* and /img/*.php
both didn't work
Title: Re: custom display
Post by: Chen Zhen on February 04, 2012, 07:25:44 PM
Do not use the asterisk as i did not set it up like that.

try...
url=/img/
Title: Re: custom display
Post by: Chen Zhen on February 04, 2012, 08:03:37 PM
This edit should work the way you wish:

File:
Sources -> Subs-Portal.php

find:
Code: [Select]
// Did we disable all blocks for this action?
if (!empty($modSettings['sp_' . $action . 'IntegrationHide']))
return false;



replace with:
Code: [Select]
// Did we disable all blocks for this action?
global $boardurl;
foreach ($display as $check)
{
if ((substr($check,0,4) == 'url=' && substr($check,-1) == '*') && substr((str_replace($boardurl, '', $_SERVER['REQUEST_URL'])), 0, strlen(substr($check,4))-1) == substr($check,4,-1))
return true;
}

if (in_array('url=' . str_replace($boardurl, '', rtrim($_SERVER['REQUEST_URL'], "#")), $display))
return true;
elseif (!empty($modSettings['sp_' . $action . 'IntegrationHide']))
return false;

You can now use a specific url or use the asterisk to allow other characters that follow.

ie. any directory or file after /img/
url=/img/*

or

ie. specific url
url=/image/example.php

Edit -> Specified replacement edit for Tips & Tricks board
Title: Re: custom display
Post by: Eudemon on February 04, 2012, 08:57:29 PM
i see, sry didn't look at the codes carefully

solved
thank you undergod your a great helper
Title: Re: custom display
Post by: Chen Zhen on February 04, 2012, 09:47:04 PM
i see, sry didn't look at the codes carefully

solved
thank you undergod your a great helper

No prob.
SimplePortal 2.3.8 © 2008-2024, SimplePortal