General developer forum

How to find a URL for a file

 
Picture of Mark Johnson
Re: How to find a URL for a file
Core developersParticularly helpful MoodlersPlugin developers

You can just build it up from the data you've got:

CONCAT('/course/view.php?id=', co.id, '#section-', cm.section) in SQL or

new moodle_url('/course/view.php', ['id' => $record->id], 'section-' . $record->section); in PHP

 
Average of ratings: -