In days gone by, naughty children who dared to scrawl on classroom walls may have expected to face six of the belt.

While their classrooms may not have been particularly cosy, with rows of desks, backbreaking chairs, blackboards and the intimidating teacher’s table.

Now, however, a new generation of modern schools is emerging –a world away from the ‘children only’ spaces of the past.

Instead of simply being ‘schools’, tomorrow’s ‘community learning campuses’ will open day, night and at weekends, incorporating everything from health clinics to council offices, public libraries, cafes and even in some, emergency services’ offices and care homes.

In school grounds, where sports days once played out, are community vegetable allotments, sensory gardens, public walking and cycling routes and community sports facilities.

And inside, are classrooms featuring walls that children are actively encouraged to write on – one way to ensure they do not become over reliant on push-button, interactive screens – playground-style chutes to inject fun by enabling children and adults to whizz between floors - funky office-style breakout zones and rooftop gardens that double as learning spaces.

Dozens of schools across the country are in the grip of a massive reform programme – the likes of which has not seen since the Nineties when local authorities embraced new PFI funding to demolish countless Victorian schools.

Read More: Teacher reveals 'failings' causing turmoil in Glasgow school

It will see a number of secondaries close and merge with neighbouring schools, campuses designed to take pupils from pre-school to secondary, and community facilities, all in one place.

The ‘open all hours’ facilities will invite the public through previously closed doors to socialise in community cafes, to use sport and fitness facilities – one school will offer a boxing ring – in libraries, to use offices, rooms and equipment.

Learning facilities – such as the art department at one school which will incorporate a kiln to make pottery - theatres, music department recording studios, and digital equipment will also become available for community use.

The ‘open to all’ campuses mean cash-strapped local authorities can shift services into one location and begin removing ageing and inefficient properties from their estates – helping to meet net zero targets.

While it also feeds into the vision for 20-minute neighbourhoods; the idea that all a community needs should be easily reached by environmentally friendly modes of transport.

However, it has also raised concerns that cramming community services into schools may mean cuts and job losses.

There are also serious questions over how pupil safety can be ensured when schools are required to open for daytime public use.

Much – but not all - of the wave of new school construction currently underway is being funded through the Scottish Government’s Learning Estate Investment Programme (LEIP). Published in 2019, the £2bn programme, funded equally by the Scottish Government and local authorities, involves 37 projects across two phases and spans schools from the Barra – where the new Castlebay Education and Health Hub will feature social care housing, primary health centre, hospital, blue light facilities, community and office space and sports facilities, to Peebles in the Scottish Borders.

The high school there is being rebuilt following a fire and will feature “active landscape” offering opportunities for outdoor exercise, walking and running routes and allotments.

In Edinburgh, where nine secondary schools and 19 primaries have been part of a programme that has seen major refurbishments and rebuilds – some funded solely by the local authority - work just started on the new Currie High School.

Set to open next year, it will become the first secondary school in Scotland designed on Passivhaus energy saving principles, which reduces the amount of energy needed for heating by up to 90%, lowers the total amount of energy used by around 70% and minimises carbon emissions.

Among its features are dining facilities that can be used by the public – potentially enabling hospitality students to run their own ‘professional’ kitchen – a wellness centre suitable for yoga groups, and community allotments.

Classrooms will offer ‘writable surfaces’ on doors, tables, walls and partitions so students and teachers can hand write and avoid over-reliance on digital technology.

Work is also due soon at the city’s Trinity Academy, which will have a “café-style community space” and rooms to hire during the day and after hours.

Other innovative ideas include a bike and kayak repair workshop.

Cllr Joan Griffiths, Education, Children and Families Convener for the City of Edinburgh Council, said: “We’re leading the way in Scotland by coming up with, and putting into practice, innovative buildings for learners and teachers which allows them to flourish and has community access designed into the projects right at the start.

“A great example is the new Castlebrae Community Campus which opened last year and has shared use of school spaces at its heart. Their Science Super Lab Collaboration area has already seen community and partnership use through the school’s working with Edinburgh University and the Bio Quarter and the entrance to the building is linked into a new community town square.

“Work has started on a new Currie Community High School which will offer the community daytime, evening and weekend access to an intergenerational community hub.

“Visitors will be able to drop into the library space in the foyer, access meeting rooms and digital services, visit the café, keep healthy at the gym and pool or enjoy a walk around the grounds where there will also be public allotments.

“The proposed new primary schools at Maybury and the new secondary school at Liberton are being designed to include GP practices.

“Having access to community facilities in high-quality modern schools for local people all year round is invaluable and can only have a positive impact by bringing people together to access a range of services.”

Craig Heap, Director at architecture practice Holmes Miller, which is involved in a number of school design projects across the country, led on the design of £15.1 million Renton Campus in Dumbarton. It features a colourful playground chute, ‘campfire’ spaces for children to gather around, STEM ‘caves’ and upper floor outdoor terraces.

He said demand has soared for schools which reflect new understanding of how children’s learning can be boosted by thoughtful classroom design. The pandemic and a drive to incorporate community facilities in schools is also impacting school design.

Community use raises the issue of security, he added. “When we are designing schools that include public libraries, for example, we have to be mindful about security.

“There have to be certain access controls and lockdown features, but we are also trying to make libraries look like community facilities that everyone can go and not behind fences.

“There are real concerns about letting people into spaces where they can get to schools but there’s also a lot we can do around access and security: it might be a shared space at front, but with a secure lobby and you can’t get through unless invited.

“We want to make everything is welcoming as possible. But there are genuine concerns about security for people coming into building during the day.”

His practice works with communities, parents, staff and pupils to mould designs for new schools, sometimes leading to “weird and wonderful” ideas.

“Everyone wants a swimming pool,” he said, “but when we ask kids what they want, they talk about gaming zones – they like to learn by doing things that are fun.”

Involving children in school designs provides a chance to see architecture and construction up close, potentially inspiring their career choices, he added.

“We are fully aware of impact we have on future generations and are very mindful of how important these buildings are.

“Teaching and learning has evolved significantly over the last 20 to 30 years, and Scotland is doing a good job at developing exciting and innovative schools and learning spaces.”