使用 Blogger(FTP、经典),如何添加对于模板而言过于复杂的功能?

发布于 2024-07-05 10:47:16 字数 134 浏览 5 评论 0原文

使用经典模板,通过 FTP 发布到自定义域。

我想添加自定义元素,例如:

  • 存档帖子的树视图(使用 CSS/JavaScript 扩展)
  • 标签云 图像
  • 幻灯片

Using classic templates, publishing via FTP to a custom domain.

I want to add custom elements such as:

  • a tree view for archived posts (expanding using CSS/JavaScript)
  • a tag cloud
  • a slideshow of images

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一个人的旅程 2024-07-12 10:47:16

我使用 PHP 来处理通过 FTP 发布的 Blogger 博客。 任何服务器端语言都可以执行此操作(ASP、ASP.NET、Python、JSP...)。

我编写了一个 PHP 脚本 (blogger_functions.php) 来扫描 Blogger FTP 的目录并生成一段 HTML 片段来表示存档层次结构 ($snippet)。

我将此 PHP 添加到我的 Blogger 模板的顶部:

<?php 

<MainPage>
$site_rootpath = "../";
</MainPage>

<ArchivePage>
$site_rootpath = "../../";
</ArchivePage>

<ItemPage>
$site_rootpath = "../../../";
</ItemPage>

include($site_rootpath."includes/blogger_functions.php");

?>

将其添加到模板的侧边栏部分:

<?php
echo $snippet;
?>

然后我将 Apache 配置为处理博客的 .html 文件中的 PHP 标签:
位于博客根目录下的 .htaccess 文件中:

AddType application/x-httpd-php .html .htm

通过这种方法,您可以在 Blogger 博客中充分利用 PHP 的功能。

I used PHP to process a Blogger blog after it is published via FTP. Any server side language can do this (ASP, ASP.NET, Python, JSP, ...).

I wrote a PHP script (blogger_functions.php) to scan the directory that Blogger FTP's to and generate a snippet of HTML to represent the archive hierarchy ($snippet).

I added this PHP to the top of my Blogger template:

<?php 

<MainPage>
$site_rootpath = "../";
</MainPage>

<ArchivePage>
$site_rootpath = "../../";
</ArchivePage>

<ItemPage>
$site_rootpath = "../../../";
</ItemPage>

include($site_rootpath."includes/blogger_functions.php");

?>

And this to the sidebar part of the template:

<?php
echo $snippet;
?>

Then I configured Apache to process the PHP tags in the blog's .html files by putting
this in a .htaccess file in the root directory of the blog:

AddType application/x-httpd-php .html .htm

With this approach you can use the full power of PHP with a Blogger blog.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文