引用单个 WordPress 页面中的文件

发布于 2024-09-10 03:48:50 字数 1220 浏览 8 评论 0原文

这个问题已经在 WordPress 支持论坛(由我)提出,可以在这里找到: http://wordpress.org/support/topic/423693?replies=1

但由于他们的响应时间慢得令人难以置信,我想我也应该在这里问。

大家好,

我使用的是WordPress 3.0,带有自行设计的主题。我正在使用一个自建的联系表单,基本上它使用 mail() 函数发送一封包含客户填写的信息的电子邮件。

但是,我似乎无法参考邮件脚本。例如,在

<form name="" action="mail.php">

如何引用mail.php? 我无法使用

<?php bloginfo('template_url'); ?>

由于某种原因 。我需要做的就是找到一种方法来引用该文件,该文件与所有其他文件(如 header.php、index.php 等)位于同一位置。

我还有另一个问题与表单完全无关,但仍然存在在同一种竞技场上。

我有一个关于该主题的幻灯片。幻灯片由 元素组成。我制作了一个名为 Slideshow.php 的单独文件,其中仅包含 元素,以便用户可以简单地打开该文件并向其中添加任何图像(即带有幻灯片的页面) ,在我的例子中,index.php 有一个 php 包含在其中,它引用了 Slideshow.php 文件)。但是,在 Slideshow.php 文件中,我无法使用以下内容引用图像:

/images/image1.gif

php bloginfo 无法在另一个 php 文件中工作,即使它是在 index.php 文件中实现的。我很困惑,如果没有可用的 php bloginfo,我该如何引用正确的文件路径???

为了不让你感到困惑,我的 bloginfo('template_url') 确实可以工作(当我链接重置 css 文件、javascript 文件等时),但它不能在我希望它在外部幻灯片中显示的任何地方工作。 php 文件和表单操作字段中。

任何帮助将不胜感激!

谢谢,阿米特

This question was already asked in the Wordpress support forums (by me) and can be found here: http://wordpress.org/support/topic/423693?replies=1

But since their response time is unbelievably slow, I figured I'd ask it here as well.

Hi all,

I'm using WordPress 3.0 with a self-designed theme. I have a self-built contact form that I'm using, and basically it uses the mail() function to send out an email with the information that the client has filled out.

However, I can't seem to refer to the mail script. For example, in the

<form name="" action="mail.php">

how do I refer to mail.php? I can't use

<?php bloginfo('template_url'); ?>

for some reason. All I need to do is find a way to refer to that file which is located in the same place as all other files (like header.php, index.php, etc. etc.)

I have another question TOTALLY unrelated to forms but still in the same sort of arena.

I have a slideshow on the theme. The slideshow consists of <img /> elements. I made a separate file called slideshow.php with only the <img /> elements in it so that the user can simply open that file and add any images to it (meaning the page with the slideshow, in my case index.php, has a php include in it which refers to the slideshow.php file). However, again, in the slideshow.php file, I can't refer to the images with the following:

<?php bloginfo('template_url'); ?>/images/image1.gif

php bloginfo doesn't work from within another php file even though it gets implemented inside the index.php file. I'm so confused, how am I supposed to refer to correct file paths without a working php bloginfo????

Just so I didn't confuse u, my bloginfo('template_url') DOES work (as I link reset css files, javascript files, etc etc), except it doesn't work everywhere I want it to like in the external slideshow.php file and in the form action field.

Any help would be greatly appreciated!

Thanks, Amit

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

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

发布评论

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

评论(2

铜锣湾横着走 2024-09-17 03:48:50

您是否尝试过:

<form method="post" name="" action="/wordpress/wp-content/themes/themname/mail.php" />

或者

<form method="post" name="" action="<?php bloginfo('template_url'); ?>/mail.php" />

对于图像。

<img src="<?php bloginfo('template_url'); ?>/images/image1.gif" alt="" />

请注意 PHP 后面的“/”。

您还可以在 PHP 中的其他位置使用 get_bloginfo()。

http://codex.wordpress.org/Function_Reference/get_bloginfo

Have you tried:

<form method="post" name="" action="/wordpress/wp-content/themes/themname/mail.php" />

Or

<form method="post" name="" action="<?php bloginfo('template_url'); ?>/mail.php" />

And for the image.

<img src="<?php bloginfo('template_url'); ?>/images/image1.gif" alt="" />

Please note the "/" after the PHP.

You can also use get_bloginfo() elsewhere in your PHP.

http://codex.wordpress.org/Function_Reference/get_bloginfo

温柔少女心 2024-09-17 03:48:50

或者您可以使用 bloginfo('url');

or you can use bloginfo('url');

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