当前位置: 首页>>代码示例>>PHP>>正文


PHP Alias::FindById方法代码示例

本文整理汇总了PHP中Alias::FindById方法的典型用法代码示例。如果您正苦于以下问题:PHP Alias::FindById方法的具体用法?PHP Alias::FindById怎么用?PHP Alias::FindById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Alias的用法示例。


在下文中一共展示了Alias::FindById方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display_page_content

function display_page_content()
{
    $areas = Areas::FindAll();
    $alias_id = requestIdParam();
    $alias = Alias::FindById($alias_id);
    ?>

	<script type="text/javascript">
		function in_array (needle, haystack, argStrict) {
		  	var key = '', strict = !!argStrict; 
		    if (strict) {
		        for (key in haystack) {
		            if (haystack[key] === needle) {
		                return true;            
		            }
		        }
		    } else {
		        for (key in haystack) {
		            if (haystack[key] == needle) {
		            	return true;
		            }
		        }
		    }
		    return false;
		}
		
		$().ready(function() {
			var area = new Array(<?php 
    $array = "";
    foreach ($areas as $area) {
        $array .= "\"{$area->name}\", ";
    }
    echo substr($array, 0, -6);
    ?>
);
			jQuery.validator.addMethod("is_area", function(value, element) {
				return this.optional(element) || !in_array(value, area, false); 
			});
	
			$("#edit_alias").validate({
				rules : {
					alias: {
						required: true,
						is_area: true
					},
					path: "required"
				},
				messages: {
					alias: "Please enter an alias, or make sure this is not also the name of an existing Area",
					path: "Please enter an path for this alias"
				}
			});
		});
	</script>
	
	<div id="edit-header" class="aliasnav">
		<h1>Edit Alias</h1>
	</div>
	
	<form method="POST" id="edit_alias">
		<p>When a user uses the Alias Path below in their browser, the HCd system will redirect them to the specified path below. Please make sure the page/event/blog entry exists or the system will not let you create the Alias. Also, the alias should not have the same name as an existing Area in the system (the system will warn you if it does). </p>
		
		<p class="display_name">
			<label for="alias">Alias:</label>
			<?php 
    textField("alias", $alias->alias, "required: true");
    ?>
			<span class="hint">Enter only the address that will go after your site root, <em><?php 
    echo SITE_URL;
    ?>
</em>. If this matches an existing Area in the system, a warning will appear.</span>
		</p>
		
		<p>
			<label for="path">Path: </label>
			<?php 
    textField("path", $alias->path, "required: true");
    ?>
		</p>
			
		<div id="edit-footer" class="aliasnav clearfix">
			<div class="column half">
		
				<p>
					<input type="submit" class="submitbutton" name="submit" value="Save Alias" /> <br />
					<input type="submit" class="submitbuttonsmall" name="submit" value="Save and Return to List" />
				</p>
				
			</div>
			<div class="column half last">
				<p><label for="delete">Delete this alias?</label>
					<input name="delete" class="boxes" type="checkbox" value="<?php 
    echo $alias->id;
    ?>
" />
					<span class="hint">Check the box and then click &ldquo;Save&rdquo; above to delete this alias from the database</span>
				</p>
			</div>
		</div>
		
//.........这里部分代码省略.........
开发者ID:highchair,项目名称:hcd-trunk,代码行数:101,代码来源:alias_edit.php


注:本文中的Alias::FindById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。