I have this code in cake php but it generates a bunch of labels along with the input that I do not like. How can I get rid of them? I just want the input.
echo $this->Form->hidden('user_role', array('value'=> '2'));
echo $this->Form->input('user_username');
echo $this->Form->input('user_password', array('type' => 'password'));
echo $this->Form->input('user_fname');
echo $this->Form->input('user_lname');
echo $this->Form->input('user_email');
echo $this->Form->input('user_phone');
echo $this->Form->input('user_cellphone');
echo $this->Form->input('user_address1');
echo $this->Form->input('user_address2');
echo $this->Form->input('user_city');
echo $this->Form->input('user_zip');
echo $this->Form->end('Submit');
Thank you
Labels are good for usability. But you can remove them in each form field adding the following:
$this->Form->input('user_username', array( 'label' => false ));
You can also disable labels by default when creating the form:
$this->Form->create('User', array('inputDefaults' => array('label' => false)));
Futher information available at their site:
http://book.cakephp.org/view/1398/options-label
http://book.cakephp.org/view/1616/x1-3-improvements
Related
So I have the following batch code:
:AddMember
cls
title Add Member
color 0A
set /p membername=Member name?
echo %membername% >>C:\Users\187242\Desktop\swag\members.txt
set /p memberpass=Member Password?
echo %memberpass% >>C:\Users\187242\Desktop\swag\memberspass.txt
echo :%membername% >>C:\Users\187242\Desktop\swag\database.bat
echo cls >>C:\Users\187242\Desktop\swag\database.bat
echo title >>C:\Users\187242\Desktop\swag\database.bat
echo color 0a >>C:\Users\187242\Desktop\swag\database.bat
echo echo Member: %membername% >>C:\Users\187242\Desktop\swag\database.bat
echo echo Password: %memberpass% >>C:\Users\187242\Desktop\swag\database.bat
echo set /p Memberoptions=What Would you like to do? >>C:\Users\187242\Desktop\swag\database.bat
echo echo 1. Nothing >>C:\Users\187242\Desktop\swag\database.bat
echo echo 2. Change Password >>C:\Users\187242\Desktop\swag\database.bat
echo echo 3. Change Username >>C:\Users\187242\Desktop\swag\database.bat
echo echo 4. DELETE User >>C:\Users\187242\Desktop\swag\database.bat
echo if "%memberoptions%"=="1" goto :Enter
echo if "%memberoptions%"=="2" goto
In the last two lines I'm trying to get the program to write the if command into another block of code, is this possible? If not is there a workaround i just havent thought of?
A far easier construction is
(
echo cls
echo title
echo color 0a
)>>C:\Users\187242\Desktop\swag\database.bat
Where the parentheses ensure the echos are redirected to the file. I've used > to create a new file. >> would append to any existing file (or create a new file if none currently exists)
The trick is to double every % that needs to be echoed to the destination file. This is because in batch, % is the escape character for %. An escape character is used to temporarily turn on or off the special meaning of the character that is escaped. In its early application an Esc was sent to a printer before a sequence of otherwise-printable characters to control underlining, bolding, italicising and other features of a printer.
There are other characters which require an escape in batch, especially > < | and ). These require caret (^) as an escape. % is the exception that required % as an escape.
It looks like you're goal is to write these two IF commands into database.bat as well. For that to work you need to escape the percent signs by doubling them:
echo if "%%memberoptions%%"=="1" goto :Enter
echo if "%%memberoptions%%"=="2" goto
Output:
if "%memberoptions%"=="1" goto :Enter
if "%memberoptions%"=="2" goto
I recently experimented with using multiple colors in one cmd window. Every color function that I find, (for example this one: http://www.dostips.com/forum/viewtopic.php?p=41155 ) are very slow, and it takes for ever to load a color map.
If you ask, by color map I mean this piece of code:
#echo off
for %%a in (0 1 2 3 4 5 6 7 8 9 a b c d e f) do (
for %%b in (0 1 2 3 4 5 6 7 8 9 a b c d e f) do (
call :color %%a%%b %%a%%b
if %%a%%b==1f call :color \n
if %%a%%b==3f call :color \n
if %%a%%b==5f call :color \n
if %%a%%b==7f call :color \n
if %%a%%b==9f call :color \n
if %%a%%b==bf call :color \n
if %%a%%b==df call :color \n
if %%a%%b==ff call :color \n
)
)
:color - some color function
With every color function in batch this code runs very slow. I suppose it is because of creating files in %Temp% directory.
Is there a color function in batch that works almost immediately if there are a lot of colors used at once? External programs or powershell counts too!
In Windows 10, as ANSI escape color sequences was implemented, you can try that:
#echo off
setlocal
call :setESC
cls
echo %ESC%[101;93m STYLES %ESC%[0m
echo ^<ESC^>[0m %ESC%[0mReset%ESC%[0m
echo ^<ESC^>[1m %ESC%[1mBold%ESC%[0m
echo ^<ESC^>[4m %ESC%[4mUnderline%ESC%[0m
echo ^<ESC^>[7m %ESC%[7mInverse%ESC%[0m
echo.
echo %ESC%[101;93m NORMAL FOREGROUND COLORS %ESC%[0m
echo ^<ESC^>[30m %ESC%[30mBlack%ESC%[0m (black)
echo ^<ESC^>[31m %ESC%[31mRed%ESC%[0m
echo ^<ESC^>[32m %ESC%[32mGreen%ESC%[0m
echo ^<ESC^>[33m %ESC%[33mYellow%ESC%[0m
echo ^<ESC^>[34m %ESC%[34mBlue%ESC%[0m
echo ^<ESC^>[35m %ESC%[35mMagenta%ESC%[0m
echo ^<ESC^>[36m %ESC%[36mCyan%ESC%[0m
echo ^<ESC^>[37m %ESC%[37mWhite%ESC%[0m
echo.
echo %ESC%[101;93m NORMAL BACKGROUND COLORS %ESC%[0m
echo ^<ESC^>[40m %ESC%[40mBlack%ESC%[0m
echo ^<ESC^>[41m %ESC%[41mRed%ESC%[0m
echo ^<ESC^>[42m %ESC%[42mGreen%ESC%[0m
echo ^<ESC^>[43m %ESC%[43mYellow%ESC%[0m
echo ^<ESC^>[44m %ESC%[44mBlue%ESC%[0m
echo ^<ESC^>[45m %ESC%[45mMagenta%ESC%[0m
echo ^<ESC^>[46m %ESC%[46mCyan%ESC%[0m
echo ^<ESC^>[47m %ESC%[47mWhite%ESC%[0m (white)
echo.
echo %ESC%[101;93m STRONG FOREGROUND COLORS %ESC%[0m
echo ^<ESC^>[90m %ESC%[90mWhite%ESC%[0m
echo ^<ESC^>[91m %ESC%[91mRed%ESC%[0m
echo ^<ESC^>[92m %ESC%[92mGreen%ESC%[0m
echo ^<ESC^>[93m %ESC%[93mYellow%ESC%[0m
echo ^<ESC^>[94m %ESC%[94mBlue%ESC%[0m
echo ^<ESC^>[95m %ESC%[95mMagenta%ESC%[0m
echo ^<ESC^>[96m %ESC%[96mCyan%ESC%[0m
echo ^<ESC^>[97m %ESC%[97mWhite%ESC%[0m
echo.
echo %ESC%[101;93m STRONG BACKGROUND COLORS %ESC%[0m
echo ^<ESC^>[100m %ESC%[100mBlack%ESC%[0m
echo ^<ESC^>[101m %ESC%[101mRed%ESC%[0m
echo ^<ESC^>[102m %ESC%[102mGreen%ESC%[0m
echo ^<ESC^>[103m %ESC%[103mYellow%ESC%[0m
echo ^<ESC^>[104m %ESC%[104mBlue%ESC%[0m
echo ^<ESC^>[105m %ESC%[105mMagenta%ESC%[0m
echo ^<ESC^>[106m %ESC%[106mCyan%ESC%[0m
echo ^<ESC^>[107m %ESC%[107mWhite%ESC%[0m
echo.
echo %ESC%[101;93m COMBINATIONS %ESC%[0m
echo ^<ESC^>[31m %ESC%[31mred foreground color%ESC%[0m
echo ^<ESC^>[7m %ESC%[7minverse foreground ^<-^> background%ESC%[0m
echo ^<ESC^>[7;31m %ESC%[7;31minverse red foreground color%ESC%[0m
echo ^<ESC^>[7m and nested ^<ESC^>[31m %ESC%[7mbefore %ESC%[31mnested%ESC%[0m
echo ^<ESC^>[31m and nested ^<ESC^>[7m %ESC%[31mbefore %ESC%[7mnested%ESC%[0m
:setESC
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set ESC=%%b
exit /B 0
)
exit /B 0
This has been written by
Michele Locati
This is really fast, no PowerShell nor FindStr slowdown.
Yes, those pure batch solutions are slow. Try cecho: http://www.codeproject.com/Articles/17033/Add-Colors-to-Batch-Files
It is very fast and displays output immediately even when there are hundreds of colors displayed in the same time.
Hope I helped :)
If you're looking for a powershell solution, Write-Host supports console colors:
Clear-Host
Write-Host "######" -ForegroundColor Green
Write-Host '" ' -ForegroundColor Yellow -NoNewline
Write-Host '21' -ForegroundColor Red -NoNewline
Write-Host ' !' -ForegroundColor Yellow
Write-Host '######' -ForegroundColor Cyan
In my view, when I call inline execution <?php echo $this->Html->script('forms/contact');?> it executes okay, but when I want the script to be loaded within the head tags it generates the code twice.
In my view:
<?php $this->Html->script('forms/contact', array('inline' => false));?>
Output:
<script type="text/javascript" src="/animalmedica/js/forms/contact.js"></script>
<script type="text/javascript" src="/animalmedica/js/forms/contact.js"></script>
Any ideas why?
I can't answer your question as to why, but I had exactly the same issue. After some trial and error I came up with this solution:
In my default layout I was using both the fetch script method and scripts for layout. I only needed one
echo $this->Html->charset();
echo $this->Html->meta('icon');
echo $this->Html->css('cake.generic');
echo $this->Html->css('grid_layout');
echo $this->Html->css('style');
echo $this->Html->css('jquery-ui-1.10.3.custom');
echo $this->Html->script('countdown');
echo $this->Html->script('page');
echo $this->fetch('meta');
echo $this->fetch('css');
echo $this->fetch('script');
echo $this->Js->writeBuffer(array('cache'=>FALSE));
//echo $scripts_for_layout;
scripts for layout is now deprecated:
http://book.cakephp.org/2.0/en/views.html#using-blocks-for-script-and-css-files
I am making something that writes a program into text file and converts into a batch script.
I need to print "if %startmenu%==1 Goto Tutorial" into the text file but I get this:
If Echo is off==1 Goto Tutorial
And I don't want to set the variable to be permanent because it is a user menu.
Echo Echo [1] Tutorial >> C:\"Offline Server"\"Local Data Base"\Config\RawServer.cmd
Echo Echo [2] Upload >> C:\"Offline Server"\"Local Data Base"\Config\RawServer.cmd
Echo Echo [3] Download >> C:\"Offline Server"\"Local Data Base"\Config\RawServer.cmd
Echo Echo [4] Exit >> C:\"Offline Server"\"Local Data Base"\Config\RawServer.cmd
Echo Set /P StartMenu >> C:\"Offline Server"\"Local Data Base"\Config\RawServer.cmd
Echo If %StartMenu%==1 Goto Tutorial
The last line is the problem.
double the percent-signs:
Echo If %%StartMenu%%==1 Goto Tutorial >> file
echo $this->Html->meta('icon');
echo $this->Html->css('cake.generic');
echo $this->Html->css('style_variation');
echo $this->Html->css('style');
echo $this->Html->css('suggest');
echo $this->Html->css('jquery.lightbox-0.5');
echo $javascript->link('jquery.js');
echo $javascript->link('jquery.lightbox-0.5.js');
echo $javascript->link('suggest.js');
i am using this code but this is not working.
Include css with
echo $this->Html->css('example');
and javascript with
echo $this->Html->script('example');
Do not write the .js extension when including javascript.