Simple View list from table columns with links to content

This is a simple one but its funny I can’t quite find examples to follow.

I have an ‘office’ model that I want to display a simple list of office_name with links to <a name> content within the view.

So in the content I have set up tables, and each table has a heading with the office_name above it:

echo ‘<h3><a name="’.$officename.’">’.$officename.’</a></h3>’;

That is built off a different db table, so before the table content, I need to first go through the office model and I want the output to be a simple list that links to the above <a name> like so:

office1 / office2 / office3 / office4

such that you click ‘office1’ and it jumps to the table with heading ‘office1’.

I understand I can do something like Office::find()->all() to get an array of offices from the db, but then do I need to loop through and add the link tags individually ? Is there a nicer way of doing it in Yii2 ?

Thanks and sorry for the noob question.

Edit: i meant table “rows” in the heading :)