I'm converting an old Smarty template setup into strict HTML/CSS + PHP. Can someone explain what the snippet of code is doing?

$grading_periods[gps].grading_period

Here is the line of code that assigns it.

$tpl->assign('grading_periods',$grading_periods);

Thanks

It's probably an array, where in the template it is used inside a foreach loop. Without more of the tpl it is hard to say.

$grading_periods[gps].grading_period

That basically tells the server to append a constant to an array and the constant grading_period would have been made with the define() function.

$tpl->assign('grading_periods',$grading_periods);

That on its own would be invalid code so in other words that code has been made possible by code before it. And guessing it assigns the string grading_periods or the constant grading_periods with a variable to its parrent.

Without seeing all of the code I can only guess that is what is happening but there is a good chance the answer to the first quote is right.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.