简体   繁体   English

如何创建可用于多个项目的图库页面?

[英]How to create a gallery page that can be used for multiple projects?

I will try to keep this short. 我会尽量保持简短。

What am I making? 我在做什么 I want to create galleries for multiple projects. 我想为多个项目创建图库。 A gallery is opened as a new page by clicking on a project's thumbnail on the main page. 通过单击主页上的项目缩略图,可以将画廊作为新页面打开。 Each gallery should have the same layout, just a different title, text and images. 每个画廊应具有相同的布局,只是标题,文本和图像不同。

How do I want to make it? 我要如何做? I could make multiple pages for each gallery, but I ideally want a single page of which the content is adjusted to the corresponding project. 我可以为每个图库制作多个页面,但理想情况下,我希望将单个页面的内容调整为对应的项目。 This should make it easy to adjust the layout for every gallery and add more galleries in the future. 这样应该可以轻松调整每个画廊的布局,并在将来添加更多画廊。 I was thinking of something like this: 我在想这样的事情:

index.html index.html

$project1Title = "Project 1";
$project2Title = "Project 2";

<a href="gallery.html">Project1Thumbnail</a> 
(Clicking this should: gallery.html>$projectTitle=$project1Title, etc.)
<a href="gallery.html">Project2Thumbnail</a>
(Clicking this should: gallery.html>$projectTitle=$project2Title, etc.)

gallery.html gallery.html

<h1>$projectTitle</h1>
<h2>$projectText</h2>
<ul>$projectImages</ul>

I know I didn't use correct syntaxes, it is just a simple example. 我知道我没有使用正确的语法,这只是一个简单的示例。

What did I try? 我尝试了什么? I tried to use php and javascript to pass variables from the main page to the gallery page, but my knowledge with these languages is not very sufficient. 我尝试使用php和javascript将变量从主页传递到图库页面,但是我对这些语言的了解还不够。

So... What are your suggestions on how to go about this? 那么...您对此有何建议? Creating multiple pages that take the layout from a single css file, creating a single page that takes the content from variables, or something else? 创建多个页面以从单个CSS文件获取布局,创建单个页面以从变量获取内容,还是其他?

I hope everything is clear, please let me know if it is not. 我希望一切都清楚了,否则请通知我。

Thanks in advance! 提前致谢!

the easiest way is to maximize the use of your database by storing gallery details and retrieving it using sql queries and eventually displaying it on your dynamic page (gallery). 最简单的方法是通过存储库详细信息并使用sql查询进行检索,并最终将其显示在动态页面(图库)上,以最大限度地利用数据库。 Generally database can store different kinds of data with different kinds of format such as file path. 通常,数据库可以存储具有不同格式的各种数据,例如文件路径。

instead of passing "$project1Title = "Project 1";" 而不是传递“ $ project1Title =” Project 1“;” title use a proper variable that can be used by your database such as id. title使用数据库可以使用的适当变量,例如id。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM