Home » PHP (page 5)

PHP

function to remove trailing slashes from URL

php function to remove trailing slashes from URL <?php private function _curSiteURL() { $pageURL = ‘http’; if ($_SERVER[“HTTPS”] == “on”) {$pageURL .= “s”;} $pageURL .= “://”; $pageURL .= $_SERVER[“SERVER_NAME”].dirname($_SERVER[‘SCRIPT_NAME’]).’/’; if (substr($pageURL, -1) == ‘/’ ): return substr($pageURL, 0, -1); else: return $pageURL; endif; } ?>

Read More »

PHP foreach loop key value

PHP foreach loop key value foreach($data  as $key => $value): echo $key; echo $value; endforeach; Example: <?php foreach($this->universities as $key => $value): if($key == $group->group_id): echo $value; endif; endforeach; ?>

Read More »

php zend Pagination

Zend pagination Zend pagination is a default option available in zend framework. Only needs to use it .The codes are apply in  controller and view class Admin_PollsocietiesController extends Core_Controller_Action { public function listsocreqAction() { $oSocReqs   = new Model_Societysignup(); $aSocReqs   = $oSocReqs->getPendingRequests(); unset($oSocReqs); //for pagination $climit  = 20; $page1 = $this->_getParam(‘page’,1); $paginator = Zend_Paginator::factory($aSocReqs); $paginator->setItemCountPerPage($climit); $paginator->setCurrentPageNumber($page1); $this->view->paginator=$paginator; $this->view->assign(‘aSocs’, $paginator); } } ...

Read More »

jquery smooth scrolling of internal anchor links

jquery smooth scrolling of internal anchor links <script> jQuery(document).ready(function(){ jQuery(‘a[href^=”#”]’).on(‘click’,function (s) { s.preventDefault(); var smarttarget = this.hash, $smarttarget = jQuery(smarttarget); jQuery(‘html, body’).stop().animate({ ‘scrollTop’: $target.offset().top }, 900, ‘swing’, function () { window.location.hash = smarttarget; }); }); }); </script> <ul> <li><h1>Contents</h1></li> <li> 1.&nbsp; <a class=”msection” style=”color:#1155CC” href=”#section_1″>Tes1</a></li> <li> 2.&nbsp; <a class=”msection” style=”color:#1155CC” href=”#section_2″>Test 2</a></li> </ul> <a id=”section_1″ name=”section_1″></a> <h1>1.Test1</h1> <p>Test content </p>

Read More »

Tweet share Button with custom Icon

Tweet share or send to Button with custom Icon We can use custom images in Tweet button. <script type=”text/javascript” src=”//platform.twitter.com/widgets.js”></script> <a href=”https://twitter.com/intent/tweet?text=Find me in Unii.com”> <img src=”<?php echo $this->baseurl(‘images/smarttips-twitter.png’); ?>” width=”203″ height=”78″ border=”0″></a>

Read More »

TinyMCE editor with file Upload and ajaxfilemanager plugin

TinyMCE editor with file Upload and ajaxfilemanager plugin TinyMCE is a common editor used in php applications. It includes all common features of editors like fck editor,ck editor..etc. One thing is missing in TinyMCE is file uploading. This editor requires extra plugin for getting file upload feature. Steps for implementing TinyMce photo upload feature is 1.Free Download TinyMce Editior 2. TInyMce ...

Read More »