How to create a back link using the Yii Framework

In the view that you wish to use add the following code for the back link. CHtml::link('Back',Yii::app()->request->urlReferrer);

March 22, 2018 · 1 min · 17 words · icarnaghan

How to create a Email link using the Yii Framework

In the view that you wish to use add the following code for the Email link. CHtml::mailto($data->email) NOTE: $data->email contains the email address, replace this variable with the relevant email address or variable that contains the email address.

March 22, 2018 · 1 min · 38 words · icarnaghan

How to delete a Cookie in Yii Framework 1.1

To delete all Cookies execute the following command: Yii::app()->request->cookies->clear(); To delete a specific cookie execute the command below, only replacing cookie_name with the name of your cookie: unset(Yii::app()->request->cookies['cookie_name']);

March 22, 2018 · 1 min · 28 words · icarnaghan

How to delete multiple branches at once with GIT

git branch -D branch1 branch2 branch3 The above command will delete branch1, branch2 and branch3 in your local repository

March 22, 2018 · 1 min · 19 words · icarnaghan

How to delete your songs one by one from your iPhone using iTunes

NOTE: This can only be done within iTunes ‘Tested in iTunes 10’ Plugin your iPhone Open iTunes Under DEVICES click on your iPhone At the Top Menu select Summary On the open page under Options check the checkbox next to Manually manage music and videos On the right menu under DEVICES expand the iPhone device by clicking on the arrow and click once on Music A list of your songs will appear on the main screen. Right click on the song that you wish to delete and select Delete and the selected song will be deleted from your iPhone.

March 22, 2018 · 1 min · 99 words · icarnaghan

How to detect the data type of a PHP variable

The data type of a PHP variable can be detected by using the built-in PHP function****gettype() (PHP 4, PHP 5) Example: $var ="This is a sentence" echo $var; //This will return "string" The following possible values can be returned: boolean integer double string array object resource NULL unknown type

March 22, 2018 · 1 min · 49 words · icarnaghan

How to disable JQuery in the Yii Framework 1.1.x

Include the following code anywhere in your application [js]<span id="urn:enhancement-f9965c67-8856-e15b-a96a-9ae613690f5b" class="textannotation">Yii</span>::<span id="urn:enhancement-0ff1ff82-84ee-005a-2d01-4a27dedfa994" class="textannotation">app</span>()->clientScript->scriptMap=array( 'jquery.js'=>false, );[/js]

March 22, 2018 · 1 min · 15 words · icarnaghan

How to display code as content using PHP as your programming language

I have the following JavaScript code that I need to display as plain content on a page and when I add it the page handles it as code instead of content. The code below I need to display as content <script src="/fancybox/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script> Answer: Use the ‘htmlspecialchars’ PHP function tdisplay the code as content htmlspecialchars - Convert special characters to HTML entities (PHP 4 & 5) See the example below ...

March 22, 2018 · 1 min · 88 words · icarnaghan

How to Embed CSS into a View using the Yii Framework 1.1

This can be done using the registerCss() method of the CClientScript class. CClientScript manages JavaScript and CSS stylesheets for views. registerCss()registers a piece of CSS code. Place code similar to the example code below in your View Yii::app()->clientScript->registerCss('customCSS',<<<CSS li { font-weight: normal; } CSS ); In the code above the first parameter is a string and ID that uniquely identifies this piece of CSS code. The second Parameter contains the CSS code. ...

March 22, 2018 · 1 min · 84 words · icarnaghan

How to embed images using PHPMailer

Use the AddEmbeddedImage method provided by the PHPMailer class. eg. $mail->AddEmbeddedImage(’test.gif’,’testImage’,’test.gif’); Parameters for AddEmbeddedImage($path, $cid, $name = ‘’, $encoding = ‘base64’, $type = ‘application/octet-stream’) $path = Path to the attachment $cid = Content ID of the attachment. Use this to identify the Id for accessing the image in an HTML form. $name = Overrides the attachment name. $encoding = File encoding $type = File extension (MIME) type. Example: <?php //Include the PHPMailer class include = 'class.phpmailer.php'; $mailer=new phpmailer(); $mailer->From =’[email protected]’; $mailer->FromName=’TechPortal'; $mailer->Subject =’TechPortal Example’; $mailer->AddAddress(’[email protected]’); $mailer->IsHTML(true); $mailer->AddEmbeddedImage(’test.gif’,'testImage’,'test.gif’); $mailer->Body =’<img src=”cid:testImage”>’; $mailer->Send(); ?> DOWNLOAD PHPMailer Class (Version: 2.0.4)

March 22, 2018 · 1 min · 97 words · icarnaghan