/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Defining/parsing/php/tpl issue

I know I messed this up badly and would like to know how to fix this

[code=php]
// Total random Start

function randomQuote ($file) {
$f = file($file);
$k = array_rand($f);
$q = $f[$k];
}

$proxiesrandom = randomQuote(“random_link.txt”);

$sRow = $proxiesrandom;
$random = $sRow[‘randomQuote’];

$tpl->parse(
‘random’,
array(
‘random’ => $q,
)
);
// Total random End
[/code]

I have a file with

[code=php]<?

function randomQuote ($file) {
$f = file($file);
$k = array_rand($f);
$q = $f[$k];
echo $q;
}

?> [/code]

A text file with random quotes
in a normal situation I would be able to use this line

[code=php]<? randomQuote(“random_link.txt”); ?>[/code]

but since my design uses tpl I cant

and I need to be able to run this in a tpl file but cant figure out how to add the above into my current design using the parse format from above.

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @mr_bill spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...