建立面包屑的方法 [英] Approaches to build breadcrumbs

查看:66
本文介绍了建立面包屑的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在一个网站上工作,该网站基本上是一个学习门户,用户将在某些类别中上某些课程。
我的要求是在页面上构建面包屑。我不想在每个页面上都进行硬编码。

I have been working on a website which is basically a learning portal and user will have certain lessons inside certain category. My requirement is to build breadcrumbs on the pages. I don't want to hard code at every page.

那么有人可以建议我使用哪些方法动态构建面包屑?

So could anybody suggest what are the approaches I can use to build breadcrumbs dynamically?

我正在使用Spring-mvc。

I am using Spring-mvc.

推荐答案

通常,如果您在谈论动态面包屑,它们是由服务器端技术生成的,而不是纯粹由客户端生成的。服务器将要知道确切的页面结构以及当前页面的父页面是什么。

Usually, if you're talking dynamic breadcrumbs, they are generated by the server-side technology, rather than purely client-side. The server is going to know the exact page structure and what pages are parents of the current pages.

这完全是不寻常的,而且很难完全在客户端进行,但肯定有可能。您可能可以执行类似刮取URL结构的操作来确定父页面。例如,如果它们位于 / lessons / lesson1 / intro ,则可以拆分该字符串,将每个值与某些 Nice值字典进行比较,然后显示教训>课程 1>简介

It'd be more unusual and difficult to do entirely client-side, but certainly possible. You might be able to do something like scrape the URL structure to determine parent pages. For example, if they are at /lessons/lesson1/intro you might split that string, compare each value against some dictionary of "Nice" values, and display "Lessons > Lesson 1 > Intro"

这篇关于建立面包屑的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆