小编Chr*_*oya的帖子

联系表格发送给我空的电子邮件

我有这个联系表格,运作良好.如果有人给我发了一封电子邮件,我就知道了 但无论出于何种原因,我都会收到空的电子邮件发送给我.由于没有人可以访问该页面,我确定不是有人向我发送空的电子邮件.我不知道问题是什么.有帮助吗?

   <form method="post" id="contactform" name="contactform" action="comment.php" id="ContactForm" name="ContactForm" method="post">

    <fieldset>

    <label>Email *</label>
    <input class="text" type="text" name="email">
    <label>Name *</label>
    <input class="text" type="text" name="name" />

    </fieldset>

    <input class="submit-button" type="submit" name="submit" id="submit" value="Send" />
</form>

and my contact.php

    <?php


    $email.= "<b>Email     : </b>".trim($_POST['company'])."<br/>";
    $email.= "<b>Name      : </b>".trim($_POST['name'])."<br/>";



    //Replace YourEmailAddress@Yourdomain.com with yours, eg:contactus@mywebsite.com
        //Both on the next line and on the mail function below.
    $headers = "From: email@email.com\r\n";
    $headers .= "Content-Type: text/html";
    mail(
            "Your Name<myname>", 
            "Header", 
            $email,
            $headers
    );
        header("www.google.com");
?>
Run Code Online (Sandbox Code Playgroud)

我的php表单中的"标题"部分是在发送表单后将用户重定向到页面.

提前致谢.

php contact-form

4
推荐指数
1
解决办法
5237
查看次数

在JS文件中使用"ñ"

我有一个由JS文件填充的表单下拉列表.我的下拉列表中的一个选项有字符ñ,但不是显示字母,而是显示: .

如何让表单显示字母?(类似于ascii代码,但对于JS?)

提前致谢...

javascript forms

4
推荐指数
1
解决办法
2万
查看次数

使用Action Mailer创建帖子后发送用户电子邮件

我有一个User模型(带有Devise)和一个属于用户的Post模型.我使用此railscast(专业版)在创建帐户后向用户发送电子邮件

我创建了一个"NewPostMailer"

这是我的邮件:

class NewPostMailer < ActionMailer::Base
  default :from => "email@gmail.com"

  def new_post_email(user)
    @user = user
    @url = "http://localhost.com:3000/users/login"
    mail(:to => user.email, :subject => "New Post")
   end
end
Run Code Online (Sandbox Code Playgroud)

我的posts_controller:

  def create
    @post= Post.new(params[:post])

    respond_to do |format|
      if @deal.save
        NewPostMailer.new_post_confirmation(@user).deliver
        format.html { redirect_to @post, notice: 'Post was successfully created.' }
Run Code Online (Sandbox Code Playgroud)

post.rb

  after_create :send_new_post_email

  private
  def send_new_post_email
    NewPostMailer.new_post_email(self).deliver
  end
Run Code Online (Sandbox Code Playgroud)

在创建帖子后,我需要更改以向用户发送电子邮件.谢谢.

ruby-on-rails actionmailer

3
推荐指数
1
解决办法
8919
查看次数

包装 Label 和 Input 元素的最佳方式是什么

我正在处理一个 HTML5 表单,我想浮动一些输入元素及其标签。这是最好的方法吗?

<form>
    <fieldset class="float_left">
        <label for="login">Login ID #</label>
        <input type="text" name="login" id="login">
    </fieldset>
    <fieldset class="float_right">
        <label for="password">Password</label>
        <input type="password" name="password" id="password">
    </fieldset>
    <span class="forgot_login float_left"><a href="#">Forgot your login information?</a></span>
    <input type="submit" value="LOG IN" class="form_button float_right">
</form>
Run Code Online (Sandbox Code Playgroud)

我看到人们将它们包装在 div、列表等中。我想遵循最佳实践。即使我不打算设计样式,我是否也应该用字段集包装每个标签和输入元素?前任:

<form>
    <fieldset>
        <label for="name">Full Name:</label>
        <input type="text" name="name" id="name" placeholder="First Name" class="float_left">
    </fieldset>
    <fieldset>
        <label for="email">Email:</label>
        <input type="email" name="email" id="email" placeholder="Ex: johndoe@gmail.com" class="full_input">
    </fieldset>
    <fieldset>
        <textarea rows="3" name="message" id="message" placeholder="1000 Character or less" class="full_input"></textarea>
    </fieldset>
    <input type="submit" value="SEND" class="form_button float_right"> …
Run Code Online (Sandbox Code Playgroud)

html forms

3
推荐指数
1
解决办法
2320
查看次数

如何异步加载JSON(iOS)

我的应用程序使用JSON解析来自Rails应用程序的信息.我正在寻找一种异步加载JSON的方法,但由于代码的复杂性,我无法使用我找到的示例来处理代码.我需要做什么才能异步加载JSON?谢谢.

- (void)viewDidLoad
{
    [super viewDidLoad];

    NSURL *upcomingReleaseURL = [NSURL URLWithString:@"http://obscure-lake-7450.herokuapp.com/upcoming.json"];

    NSData *jsonData = [NSData dataWithContentsOfURL:upcomingReleaseURL];

    NSError *error = nil;

    NSDictionary *dataDictionary = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];

    NSArray *upcomingReleasesArray = [dataDictionary objectForKey:@"upcoming_releases"];

    //This is the dateFormatter we'll need to parse the release dates
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"];
    NSTimeZone *est = [NSTimeZone timeZoneWithAbbreviation:@"EST"];
    [dateFormatter setTimeZone:est];
    [dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]]; //A bit of an overkill to avoid bugs on different locales

    //Temp array where we'll store the unsorted …
Run Code Online (Sandbox Code Playgroud)

json ios

3
推荐指数
1
解决办法
6326
查看次数

打开图库时如何不显示第一张图片 - Fancybox 2

我使用Fancybox 2创建了一个图片库,其中包含他们网站上的示例:http://fancyapps.com/fancybox.

我使用"display:none;"隐藏了除第一个以外的所有图像

HTML

<a class="fancybox" href="http://fancyapps.com/fancybox/demo/1_b.jpg"><img src="http://fancyapps.com/fancybox/demo/1_s.jpg" alt=""/></a>
<div class="hidden">
   <a class="fancybox" href="http://fancyapps.com/fancybox/demo/2_b.jpg"><img src="http://fancyapps.com/fancybox/demo/2_s.jpg" alt=""/></a>
   <a class="fancybox" href="http://fancyapps.com/fancybox/demo/3_b.jpg"><img src="http://fancyapps.com/fancybox/demo/3_s.jpg" alt=""/></a>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS

.hidden {
    display: none;
}
Run Code Online (Sandbox Code Playgroud)

JS

$(".fancybox")
    .attr('rel', 'gallery')
    .fancybox({
        padding : 0
    });
Run Code Online (Sandbox Code Playgroud)

单击打开图库后,我想隐藏第一个图像,以便图库打开第二个图像.我怎样才能做到这一点?

谢谢.

jquery fancybox fancybox-2

2
推荐指数
1
解决办法
6584
查看次数

创建Rails音乐播放器应用程序(类似于Rdio)

我想创建一个有很多混音带的rails应用程序,用户可以收听和下载(如datpiff.com).所有混音带都将由我上传.每个mixtape都有自己的页面,标题,艺术家姓名,封面等.

我无法正确使用应用程序的架构.什么是上传所有混音带的最佳方式.(我在想像Amazon S3这样的东西).

我是否必须使用整个混音带,每首歌曲或压缩文件上传压缩文件.

如何显示每首歌曲的信息(标题,长度等)

当然,最大的问题是mixtape的流媒体和文件的下载.

任何人都可以指导我最新的创建这个应用程序的方法.(Rails是最好的方法吗?)

提前致谢.

streaming ruby-on-rails amazon-s3

1
推荐指数
1
解决办法
3026
查看次数

使用AFNetworking 2和Reachability没有互联网连接警报

我正试图弄清楚如何使用AFNetworking 2和Reachability显示"无互联网连接"警报.

我将Reachability和AFNetworking导入到我的Controller中.我的代码部分以我从AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager alloc] initWithBaseURL:url];AFNetworking 2文档中复制开始,我不确定它是否属于它.

UPDATE

我的应用程序现在显示一个警报,只要没有互联网连接,但它需要太长时间才能显示警报,我也怀疑这是我可以构建我的代码的最佳方式.(另外如果我在主视图控制器上,当没有连接时我点击一个单元格应用程序崩溃,我不知道是否有办法解决这个问题).

- (void)viewDidLoad

{
    [super viewDidLoad];

    Reachability * reach = [Reachability reachabilityWithHostname:@"www.google.com"];

    reach.reachableBlock = ^(Reachability * reachability)
    {
        NSLog(@"Reachable");
    };

    reach.unreachableBlock = ^(Reachability * reachability)
    {
        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"No internet connection"
                                                         message:@"No internet connection"
                                                        delegate:self
                                               cancelButtonTitle:@"Ok"
                                               otherButtonTitles:nil];
        [alert show];
        NSLog(@"Not Reachable");
    };

    [reach startNotifier];

    self.upcomingReleases = [[NSMutableArray alloc] init];

    [self makeReleasesRequests];

    self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; // Make nav items white

    [self.collectionView registerClass:[ReleaseCell class] forCellWithReuseIdentifier:@"ReleaseCell"]; …
Run Code Online (Sandbox Code Playgroud)

reachability ios afnetworking

1
推荐指数
1
解决办法
6062
查看次数

UICollectionView的可见接口没有声明选择器indexPathForSelectedRow

我正在尝试将我在Table View Controller上的代码更改为Collection View Controller,现在我正试图让Segue工作,但是我收到了这个错误:

'UICollectionView'没有可见的@interface声明选择器'indexPathForSelectedRow'

这是我的Segue:

- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ( [segue.identifier isEqualToString:@"showUpcomingRelease"]){
        UpcomingReleaseViewController *upcomingReleaseViewController = (UpcomingReleaseViewController *)[segue destinationViewController];
        upcomingReleaseViewController.singleRelease = [self.upcomingReleases objectAtIndex:[[self.collectionView indexPathForSelectedRow] row]];
    }
}
Run Code Online (Sandbox Code Playgroud)

谢谢.

objective-c ios

0
推荐指数
1
解决办法
2492
查看次数