开发者

Logic for displaying and accessing links of a CMS?

We have a Content Management System where we create content of different types. Web Content,File Attachments and URL. After the content is created its displayed on the site in the form of links. The link title its content,url file attachement and any other metadata is stored in the database. When clicking on links we have to open the content if the content is file attachment it should download.If its url it should open in new window. If its web content it should show in same page. Also when we access a content 开发者_如何学编程we need to maintain the access matrix. Can somebody suggest a solution for this. I am actually looking for logic.


You can partially control the browser behavior using headers when user clicks the download link by supplying the mime type like this:

header("Content-Type: image/jpg");

Then the browser should open it inside the window as an image (Naturally you would have to supply the file contents after the header). To force download, you set the Content-Type to:

header("Content-Type: application/force-download");

As for the urls you can simply use target=_blank like so:

<a href="http://www.google.com" target="_blank">Google</a> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜