editing Randomizer set
Posted: 22 July 2005 10:39 AM   [ Ignore ]  
Summer Student
Total Posts:  6
Joined  08-25-2004

When you are just figuring out something new, you often find yourself working on a part of the whole that is just not that important, but anyway, there you are.
That has happened to me in my learning curve phase of using EE.
I tried to edit the pi.randomizer.php file, adding a second set of quotations.
Here’s what I added:

function set_two()
{
$quotes
= array(
Aude sapere - "Dare to know"
Caveat emptor - "Let the buyer beware"
Cogita ante salis - "Think before you leap"
Facta, non verba - "Deeds, not words."
);

return
$quotes[array_rand($quotes)];    
}


But when I changed

<title>{exp:randomizer:set_two}</title>


in my index page, I got an error msg which I’ve duly forgot and didn’t note, but it was along the lines of “T_string error in pi.randomizer.php”.
Is there something obvious I’ve screwed up?
Thanks for the help, amigos.
Dan

Profile
 
 
Posted: 22 July 2005 11:22 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  16183
Joined  05-15-2004

Did you take a look at set_one? You are filling an array here, which means each element needs to be separated with a comma, and probably needs to be quoted also:

function set_two()
{
$quotes
= array(
"Aude sapere - Dare to know",
"Caveat emptor - Let the buyer beware",
"Cogita ante salis - Think before you leap",
"Facta, non verba - Deeds, not words." // no comma here
);

return
$quotes[array_rand($quotes)];    
}

If you still want quotes, try using HTML entities, &quot;

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 22 July 2005 11:29 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
RankRank
Total Posts:  265
Joined  11-13-2002

You should also be able to enclose double quotes in single quotes, as in:

function set_two()
{
$quotes
= array(
'Aude sapere - "Dare to know"',
'Caveat emptor - "Let the buyer beware"',
'Cogita ante salis - "Think before you leap"',
'Facta, non verba - "Deeds, not words."' // no comma here
);

return
$quotes[array_rand($quotes)];    
}

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 66464 Total Logged-in Users: 63
Total Topics: 84852 Total Anonymous Users: 18
Total Replies: 455305 Total Guests: 207
Total Posts: 540157    
Members ( View Memberlist )
Newest Members:  MikeCunsolodrivenewmediaTgunRooks TowermarkfavazzastephenhfoxysaxAtosheviboyjbcobbs