Welcome to Geeklog Tuesday, November 30 2021 @ 01:38 am EST

Geeklog Forums

right phpblock


Smokey

Anonymous
hopeful
Hi,

I made a phpblock, used the phpblock_prefix and updated the lib-custom.php No problem here, all works fine (on the left)
When changing the block to the right only the tittle is showing.

Can someone tell me what I am missing, or doing wrong?

Thanks in advance,
Smokey
 Quote

Smokey

Anonymous
This is the code i'm talking about.

PHP Formatted Code
function phpblock_spons()
{
$retval .= "<?php include 'http://www.mydomain.nl/mypage.php'; ?> ";
return $retval;
}

 


It works when the block is on the left side but it doesn't work when i change the block to the right.

Cheers,
Smokey
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 22/03/04
Posts: 1512
by design the left blocks will parse the php that you've inserted into it because they are loaded from within the header.thtml, which will have its php parsed whereas no other thtml files will. So any php in the right blocks, which are typically loaded from the footer will not be parsed.

you might as well have used a normal block on the left and put your php in the content area--that's basically what you did by returning the php open and close thingies. Try this function instead:
PHP Formatted Code
function phpblock_spons()
{
include 'http://www.mydomain.nl/mypage.php';
}
 
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/02
Posts: 13073
Location:Stuttgart, Germany
Quote by machinari: by design the left blocks will parse the php that you've inserted into it because they are loaded from within the header.thtml, which will have its php parsed whereas no other thtml files will.

This was actually never intended and fixed in 1.4.0. So with 1.4.0, the above would have consistently not worked on both sides Wink

bye, Dirk
 Quote

Smokey

Anonymous
Thanks for your help but changing te function you suggested doesn't include the page in a block, but at the top of the page.
If you have any other suggestions i will be glad to try them.

Thanks again,
Smokey
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/02
Posts: 13073
Location:Stuttgart, Germany
PHP blocks have to return the content they want displayed to Geeklog. So you have to read the output of that included file into a variable and return it at the end of the function.

bye, Dirk
 Quote

zephyrius

Anonymous
Even if i return the data at the end of the php function, it is still not displayed if it's a "right block." It works fine as a left block. I am using 1.4.0sr3.

Is there a way to get the returned HTML from that function to display in a right block?

Thanks,
Zephyrius
 Quote

All times are EST. The time is now 01:38 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content