Skip to main content

Check String in String and push content to end file


Check String in String and push content to end file

$menu_data = @file_get_contents('layouts/v7/modules/Vtiger/partials/SidebarAppMenu.tpl');
$txt = "\n <script type=\"text/javascript\">   jQuery(document).ready(function () {      var app_menu = jQuery(\"#app-menu\");      var hrm_menu = app_menu.find(\"#HRM_modules_dropdownMenu\");        hrm_menu.attr('data-default-url','index.php?module=Employee&view=Index&app=HRM');    });</script>";
if(strpos($menu_data,$txt) === false){
    $myfile = @file_put_contents('layouts/v7/modules/Vtiger/partials/SidebarAppMenu.tpl', $txt.PHP_EOL , FILE_APPEND | LOCK_EX); 
   echo "Push ok !";
}

Comments

Popular posts from this blog

Sample VS code setting

  When you are a software developer, you need to configure your IDE working with most convinience for your working, bellow is a sample code snippet to config your IDE {   "diffEditor.ignoreTrimWhitespace" : false ,   "javascript.updateImportsOnFileMove.enabled" : "always" ,   "[typescriptreact]" : {       "editor.defaultFormatter" : "esbenp.prettier-vscode"   },   "editor.formatOnPaste" : true ,   "workbench.settings.applyToAllProfiles" : [],   "editor.tabSize" : 2 ,   "redhat.telemetry.enabled" : true ,   "editor.codeActionsOnSave" : {       },   // "editor.codeActionsOnSave": {   //   "source.fixAll": "explicit",   //   "source.fixAll.eslint": "explicit",   //   "source.organizeImports": "explicit",   //   "source.sortMembers": "explicit",   //   "javascript.showUnused": "...

Docker Compose: Node.js Express and MongoDB example

  Docker   provides lightweight containers to run services in isolation from our infrastructure so we can deliver software quickly. In this tutorial, I will show you how to dockerize Nodejs Express and MongoDB example using   Docker Compose .