I would like to edit the 'regards, {application name}' part in the toMail Notifications without publishing the blade template files. Imo its an overkill to do so
Part in Question is here
I know Laravel provides several functions to change the contents of the Mail but this part seems to always stay the same unless edited via the template files.
Thank you in advance!
So after some digging through the files I found the solution and it's pretty easy:
return (new MailMessage)
->from('info#test.com', 'Testorganisation')
->subject('Your mailsubject')
->greeting("Hello $notifiable->name,")
->salutation("You are welcome"); // Change this for a different salutation
This results in this output
It's handled via the subject-Function inside the SimpleMessage.php file located in /vendor/laravel/framework/src/Illuminate/Notifications/Messages/
Hope this helps someone, since I didn't find a solution other than publishing the blade templates.
I don't know when the function was added, but works in Laravel 8+
Related
Well, I am developing a plugin a and I need to display some stuff from my plugin when TYPO3 page load.
Is there some function how to hook action, like in WordPress when page loads than plugin will execute some controller method? Then this controller will produce some output a HTML, which I would like to dispaly in frontend page. Specially I would like display custom script in the head. So the script should be like this <head>...<script>my content</script>...</head>
Ok, what you probably want to do is to develop a so-called TYPO3 extension - that's what plugins/add-ons are called in TYPO3 (which is the term you will likely find google results for).
To get started fast you can try the TYPO3 extension builder (https://docs.typo3.org/typo3cms/extensions/extension_builder/) - which can generate a skeleton extension for you.
For more information you can also have a look at https://docs.typo3.org/typo3cms/CoreApiReference/latest/ExtensionArchitecture/Index.html which explains the concepts in far more detail.
Additional information is available in https://docs.typo3.org/typo3cms/ExtbaseFluidBook/Index.html
in TYPO3 there is something named plugins, but you should differ to the meaning in other context.
first TYPO3 is a CMS which content is structured in a hierarchical tree of pages. These pages are the basis for navigation. and each page contains individual contentelmenents (CE).
As Susi already told: add ons to TYPO3 are in general 'extensions' which could extend(!) the functinality of TYPO3 in different ways. one way is the definition of (TYPO3-)Plugins. These are special ContentElements which enable to show special information.
While normal CEs have all the information what to show in the record (e.g. Text & Image), plugins can be more flexible.
typical examples are: show a list of records OR one record in detail.
These Plugins can be controlled with typoscript or the plugin-CE could have additional fields to hold information what to display.
For detailed information how a plugin is defined consult the links given by Susi.
And be aware: for security reasons it is not possible to just execute a plain PHP file to echo any output. You need to register your plugin using the API, build your output as string and return the generated HTML as string to the calling function. For beginners the ExtensionBuilder will help you to generate a well formed extension which uses the API to register and output your data.
OK guys, thanks for your answers, but it was not very concrete. I found this solution, is not the best one, but it works! If anybody has better please share.
At first, you have to make a file for the class which will be called from the hook at location /your-plugin-name/Classes/class.tx_contenthook.php. Filename have to have this pattern class.tx_yourname.php Inside we will have a code with one method which will be called by the hook.
class tx_contenthook {
function displayContent(&$params, &$that){
//content of page from param
$content = $params['pObj']->content;
//your content
$inject = '4747474747';
// inject content on
$content = str_replace('</body>', $inject. '</body>', $content);
// save
$params['pObj']->content = $content;
}
}
And next, we have to call it on the hook. So Let's go to /your-plugin-name/ext_localconf.php and add there these two lines, which makes a magic and handles also caching.
// hook is called after caching
$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-output'][] = 'EXT:' . $_EXTKEY . '/Classes/class.tx_contenthook.php:&tx_contenthook->displayContent';
// hook is called before caching
$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-all'][] = 'EXT:'. $_EXTKEY .'/Classes/class.tx_contenthook.php:&tx_contenthook->displayContent';
I hope this will help those who struggling with typo3.
I came from CakePHP and just started playing with Django framework. In CakePHP, I have the habit of printing out all the returned array using pr() straight out to the webpage. For example:
A controller spits out a $result to a View, I use pr($result) and it will print out everything right on the webpage so I know how to travel through $result from my View.
A form POST a $request to a Controller, I use pr($request) to see what is sending in before processing it in the Controller. The content of $request will be displayed immediately on the webpage right after I hit Submit the form.
I'm wondering if I could do the same thing in django instead of going to the shell and try pprint (or could I just use pprint to print out to the web???)
This is a really simple example about what I'm talking about:
app_name/views.py:
def detail(request, soc_id):
soc = get_object_or_404(Soc, pk=soc_id)
return render(request, 'socs/detail.html', {'soc': soc})
How can I just view clearly what is in "soc". In cakephp, I could just pr($soc) right there and it will be displayed right on the detail.html page.
I have tried this and it didn't work (I'm sure it's basic but i'm just new to this)
import pprint
def detail(request, soc_id):
soc = get_object_or_404(Soc, pk=soc_id)
pprint.pprint(soc)
return render(request, 'socs/detail.html', {'soc': soc})
I have spent two days doing research but I couldn't find the answer. I'm hoping one of you can help this newbie out.
The way you're trying to print will show the print in the terminal that is running your Django server. If you just need to see it quick, check there.
If you want to output the value on to the rendered page, you'll have to include it in the template using template tages. It looks like you send {'soc': soc} to your template as context. Because of this, you should be able to use it in your template. So, in your template (socs/detail.html), just add {{ soc }} somewhere and it should print out the value. The template has full access to the object, so if you wanted something specific, you can also print that instead (like {{ soc.id }}).
If you want to see everything that's in the object without specifying all of the different fields yourself, send OBJECT.__dir__. For example, for this you'd send {'soc': soc.__dir__} as your context. Keep in mind that this likely should not be used for anything but inspection on your part.
If you'd like to learn more about Django's templating, check out the syntax and more.
I'm trying to create a messages.pot file for my application using the workflow described in the docs. Unfortunately, I can't get this to work. I can render the cached version of my templates, but when running xgettext, no strings are recognized.
After inspecting a cached template, I see calls being made to
echo $this->env->getExtension('translator')->getTranslator()->trans("Yadda", array(), "messages");
I guess xgettext only looks for calls to gettext(), dcgettext(), etc. Am I missing something here? How to fix this?
I'm using Silex 2.0.3-dev, twig 1.24.1, twig-bridge 3.0.7.
i had the same problem... i found no way to get it by the translator component, so i wrote and node js script to parse the twig files...
here is the pastebin link... if u like to update the file or something please contact me probably we can put it on github...
http://pastebin.com/WSDsABfz
I want a piece of code on the index of my Code Igniter's script so I can change the identety or name of my controller from agent69 to agent007_and_supergirl,and also a way to beat any rule that pages might have against using underscore to separate words as an amendment.
In other words I want that all the calls that the processor of my server has inside my code igniter for agent69 be translated to calls to agent007_and_supergirl
Is just a change of identety for the controller without altering the main controler's functionality and without getting my hands dirty with coding.
If you want re route your default controller url, you have to edit routing configuration like this:
in application/config/route.php
$route['agent007_and_supergirl'] = 'agent69';
Now agent69 Controller will be accessible by http://youriste.com/agent69 and http://yoursite.com/agent007_and_supergirl as well
CodeIgniter URI Routing Guide
Working on config/routes.php yelded miserabe results on past,remember that is an identity matter
And I want all the calls of agent69 be sent to agent007_and_supergirl that is its new identity
What was successfull on the past about this mattar was controller and file cloning,it worked masterfully
but this only intercepted few server calls so for me to get all the server calls, I need to clone every
single fie on the script so I feel silly teling you again thats why I didnt want to get my hands dirty with code
because is plenty of code.
Well hope that you can help me master this code that goes on the index of my code igniter script--///The code cant appear here so its below in the comment to lighta thanks 4 readin
I'm trying to find a simple wiki like script to setup a personal directory, browser favorites simply doesn't do anymore and i have lots of small files on my flash drive
Desired features
file upload
not bloated
works on a common webhost (aka php)
Thanks in advance
Google Sites functions as a Wiki, and you don't have to make your site public. You can upload files, but there's a 100MB limit for a site. The big advantage here (IMO) is the fact that you don't have to worry about setting up hosting at all.
It has a WYSIWYG editor, so that's a minus if you're really into some particular Wiki syntax, I guess.
Another (non-hosted) option would be TiddlyWiki, which is completely implemented in Javascript and meant to be used on a USB drive, primarily.
I recommend Dokuwiki. Uses text files instead of a database.
A couple of people have recommended Tiddlywiki. I've used it for a simple wiki setup... It's nice, fast, and easy.
You mentioned the need for web-access... Tiddlywiki combined with TiddlyHome is what I use for a simple, single-html-page wiki, which can be used both offline and online...
Another possibility is to use one of the new saving options listed at https://tiddlywiki.com/#Saving, including a Node.js or PHP server, or Google Drive/Dropbox/WebDAV (Sharepoint) integration.
I think this could help you find one that suits your needs: http://www.wikimatrix.org/
I found also this nice script: Hatta
Checkout LionWiki - http://lionwiki.0o.cz
It works from just one file and it's dead simple.
Here's one:
<?php function p($c){$r=preg_replace(array("~^ +([^\n]+)~m",'~^-\s+(.*)$~m',
"~-{4,}\r?\n~",'~(http(?:s)?)://([^\s]+)~i','~\n~'),array('<code>$1</code>','<li>$1',
'<hr>','<a href=$1://$2>$2</a>','<br>'),$c);preg_match_all('~([A-Z]\w+){2,}~',$r,
$x);foreach(array_unique($x[0])as$m){$r=str_replace($m,x($m)? "<a href=?$m>$m</a>":
"$m<a href=?e=$m>?</a>",$r);}return$r;}function f($f){#mkdir('wik');return
#file_get_contents("wik/$f.w");}function b($b){echo"<h1><a href=?$b>Backlinks $b"
."</a></h1><div id=c>";foreach(glob('wik/*.w')as$f){$f=substr($f,4,-2);if(strpos(
f($f),$b)!==false)echo"<a href=?$f>$f</a><br>";}echo"</div>";}function x($f){
return file_exists("wik/$f.w");}function e($p){$p=$p?$p:$_GET['e'];echo"<h1>Edit"
." $p</h1><form action='?$p' method=post><textarea name=c cols=50 rows=10>".f($p)
."</textarea><br><input type=submit value=Save>";}$p=preg_replace('~(e|b)=(.*)~'
,'',$_SERVER[QUERY_STRING]);$c=$_POST[c];$e=$_GET[e];$b=$_GET[b];if(!$p&&!$e)$p=
'MainPage';if($c){#file_put_contents("wik/$p.w",htmlspecialchars($c));header(
"Location: ?$p");}echo"<title>Wik Wiki</title>";if(!$e){if(!$b){echo x($p)?
"<h1><a href=?b=$p>$p</a></h1><div id=c>".p(f($p))."</div><hr><a href=?e=$p>"
."Edit</a> | <small>Modified: ".date('d.m.Y # H:i:s', #filemtime("wik/$p.w"))
:e($p);}else b($b);}else e($e);
It's from http://c2.com/cgi/wiki?WikWiki. It doesn't have file upload but you should be able to add it without bloating. I've used it as a private notepad and it works well, you just have to make sure the web server has write permissions on the wik directory