How to use Filelink in typo3


 
How to set custom HTML in Filelink of typo3

First you have to install “css_filelinks” extensions.

Then after you have to enable configuration from this extension. you have to check below two configuration.

  => Don't insert _CSS_DEFAULT_STYLE [dont_default_css]
  => Allow the "Read from path" field [allow_read_from_path]

You can check configuration in below image

Filelink Extension, css_filelinks

Filelink Extension, css_filelinks

Integrate your plugin and you can insert your media files. like : image, pdf, excel, csv, powerpoint, dco files.

Filelink Extension, css_filelinks

Filelink Extension, css_filelinks

If you want to wrap this element with your HTML then you can use below typoscript for that.

********************************************************
*For File Links Layout
*******************************************************
additionalClass{
        image=bmp,gif,ico,jpg,png,tiff
        video=wmv,avi,asf,mpg,mp4
        audio=mp3,wav,mid
}

tt_content.uploads.20.layout.file >
tt_content.uploads.20.layout.file.cObject=COA
tt_content.uploads.20.layout.file.cObject{
  wrap=<div class="row"> | </div>
  10 = TEXT
  10.wrap=<span> | </span>
   10.value= <div class="titel">###DESCRIPTION###</div><div class="type"><a target="_blank" href="###URL###"><img alt="img" src="fileadmin/images/###FILEEXT###.png"></a></div><div class="download"><a target="_blank" href="###URL###"><img alt="img" src="fileadmin/images/download_icon.png"></a>  </div><a target="_blank" href="###URL###"></a>
}

tt_content.uploads.20.layout{
  global=<div class="documenten"><div class="row"><div class="titel"><strong>Titel</strong></div><div class="type"><strong>Type</strong></div><div class="download"><strong>Download</strong></div></div>###FILE###</div>
}

For more info regarding this extension you can visit here

It will look like below image.

Filelink Extension, css_filelinks

Filelink Extension, css_filelinks

*Note : You have to set css for that and also you can set your own icon.

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

How to translate your page with google translate.


For translate your page. you have to use below code for translate your page with google translate.


<script src="ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

<div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'auto',layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
I love my self

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

How to add option to drop down list using jQuery


For add option using jQuery you can use below HTML and jQuery code.

<html>
   <head>
      <title>How to add option to drop down list</title>
      <script src="http://code.jquery.com/jquery-latest.js"></script>
      <style type="text/css">
         div.demo
         {
         float:left;
         padding:25px;
         }
         #text {
         width:auto;
         margin-top: 20px;
         }
      </style>
      <script type="text/javascript">
         jQuery(document).ready(function($){
         $('.addoption').click(function(){
         	$("#text").css("display","block");
         });
         $('.Button1').click(function(){
         	var as = $("#addtext").val();
         	if(as != ""){
         	$('.DropDown').append($('<option></option>').val(as).html(as).attr('selected', 'selected'));
         	$("#addtext").val("");
         	}else{
         		alert("Write Text In Textbox");
         	}
         });
         });
      </script>
   </head>
   <body>
      <div class="dd">
         <select class="DropDown">
            <option>--Select--</option>
            <option value="Value 1">Value 1</option>
            <option value="Value 2">Value 2</option>
         </select>
         <button class="addoption">Click to add option</button>
      </div>
      <div id="text" style="display: none">
         <table cellpadding="0" cellspacing="0">
            <tr>
               <td>
                  <label> ADD TEXT</label>
               </td>
            </tr>
            <tr>
               <td>
                  <input type="test" id="addtext" value=""/>
               </td>
            </tr>
            <tr>
               <td>
                  <input type="button" value="Add"  class="Button1"/>
               </td>
            </tr>
         </table>
      </div>
   </body>
</html>

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

How to check url exits or not in PHP


How to check file exist in given URL – PHP.

FOr check url exist or not you have to use below function for it.

you can also check for xml path exits or not.


	$url = "www.hariomrubber.com/sitemap.xml";
	
	if($this->is_url_exist($url))
	{
		echo "URL is exists";
	}else{
		echo "URL is not exists";
	}

	function is_url_exist($url)
	{
		$ch = curl_init($url);    
		curl_setopt($ch, CURLOPT_NOBODY, true);
		curl_exec($ch);
		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
	
		if($code == 200){
			$status = true;
		}else{
			$status = false;
		}
		curl_close($ch);
		return $status;
	}
	

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

How to display table content in tab of typo3 extension


 
For display table content in tab of custom extension.

First you have to set “‘dividers2tabs’ => true” in exe_table.php file.

   'dividers2tabs' => true,

Dividers 2 tabs

Dividers 2 tabs


then after you have to modify tca.php file.

below code is original code of Tca file

'types' => array (
	'0' => array('showitem' => 'hidden;;1;;1-1-1, title;;;;2-2-2, images;;;;3-3-3, logo, small_image, address, place, types ')	
),

For set tab you have to add “–div–;Tab1,” before field name.

“Tab1” is stand for title of the tab. Below code is modified code

'types' => array (
	'0' => array('showitem' => '--div--;Tab1,hidden;;1;;1-1-1, title;;;;2-2-2, --div--;Tab2,images;;;;3-3-3, --div--;Tab3,logo, small_image,--div--;Tab4, address, place, --div--;Tab5,types ')
),
Tab in TCA

Tab in TCA

It will look like below image

TCA, Extension, table

TCA, Extension, table

I hope it will help you.. Good luck 🙂

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

How to add custom headers in TYPO3 backend


#Add this to page resource
Set below TypoScript Configuration in page edit porperty.

TCEFORM.tt_content.header_layout {
    addItems {
        10 = Gray Header
        11 = Orange Header
        12 = Red Header
    }
}
Custom header resource

Custom header resource

After set above TypoScript Configuration in page edit porperty. It will display in your “Type”
It will look like in below image.

Custom header in typo3

Custom header in typo3

If you want to wrap that section element with your HTML then you have to set below TypoScript

lib.stdheader.10.10 < lib.stdheader.10.1
lib.stdheader.10.10 {
  dataWrap = >h1 class="gray_header"<|>/h1<
}

lib.stdheader.10.11 < lib.stdheader.10.1
lib.stdheader.10.11 {
  dataWrap = <h1 class="orange_header">|</h1>
}

lib.stdheader.10.12 < lib.stdheader.10.1
lib.stdheader.10.12 {
  dataWrap = <h1 class="red_header">|</h1>
}

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

How to download image, PDF, Excel in php


 
How to download image using in php,
How to download PDF using in php,
How to download Excel using in php,
How to download CSV using in php
How to download PSD using in php

For download images, pdf, excel, zip, csv, tiff, bmp, PSD, ico using php then you can use below code.

$inPath = "IMAGE_ROOT_PATH";
$outPath = "IMAGE_NAME";

$fullPath = $inPath.$outPath;
 
	$tmp = explode(".",$outPath);
	$fsize = filesize($fullPath);

	switch ($tmp[count($tmp)-1]) {
	
	  case "pdf": $ctype="application/pdf"; break;
	  case "exe": $ctype="application/octet-stream"; break;
	  case "zip": $ctype="application/zip"; break;
	  case "docx":
	  case "doc": $ctype="application/msword"; break;
	  case "csv":
	  case "xls":
	  case "xlsx": $ctype="application/vnd.ms-excel"; break;
	  case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
	  case "gif": $ctype="image/gif"; break;
	  case "png": $ctype="image/png"; break;
	  case "jpeg":
	  case "jpg": $ctype="image/jpg"; break;
	  case "tif":
	  case "tiff": $ctype="image/tiff"; break;
	  case "psd": $ctype="image/psd"; break;
	  case "bmp": $ctype="image/bmp"; break;
	  case "ico": $ctype="image/vnd.microsoft.icon"; break;
	  default: $ctype="application/force-download";
	}
	
	header("Pragma: public"); // required
	header("Expires: 0");
	header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
	header("Cache-Control: private",false); // required for certain browsers
	header("Content-Type: $ctype");
	header("Content-Disposition: attachment; filename=\"".$outPath."\";" );
	header("Content-Transfer-Encoding: binary");
	header("Content-Length: ".$fsize);
	ob_clean();
	flush();
	readfile($fullPath);
	die;

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya