Welcome to Geeklog Sunday, November 17 2019 @ 10:57 pm EST

Geeklog Forums

function calls in static pages


Status: offline

amckay

Forum User
Full Member
Registered: 23/03/02
Posts: 180
OK, so I have it working. It's really easy. Inside public_html/staticpages/index.php insert the following function :


function ParseForFunctionCalls($myStr)
{
$workStr = $myStr;
$newStr = "";

while( $callBegin = strpos( $workStr, "[call]" ) )
{
$newStr .= substr( $workStr, 0, $callBegin );
$callEnd = strpos( $workStr, "[/call]" );
$newWorkStr = substr( $workStr, $callEnd + 7 );
$funcname = trim(substr( $workStr, $callBegin + 6,$callEnd - $callBegin - 6 ));
$newStr .= $funcname();
$workStr = $newWorkStr;
}

return $newStr . $workStr;
}


And you insert the call just after line 100 right after the DB_fetchArray :


$A['sp_content'] = ParseForFunctionCalls($A['sp_content']);


And within your static pages you can insert any number of [call]someFunction[/call] statements that you like!

This is going to be a very huge improvement for my website - don't know why I didn't get around to it earlier.

cheers,
-Alan


Anonymous

Anonymous
Thanks much. This will come in handy.

Status: offline

amckay

Forum User
Full Member
Registered: 23/03/02
Posts: 180
BTW, my code appears to not work if [call] is the very first characters in a static page, or [/call] is the very last. If I get around to fixing it I'll post an update. In the meantime I just do not let that happen ;-)

All times are EST. The time is now 10:57 pm.

  • 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