Change Blog Post Layout of Frappe Framework - erpnext

how to modify the layout of Blog Post in a secure way?
so when there’s an update, the changes won’t be gone.
I’m talking about the template in here: apps/frappe/frappe/website/doctype/blog_post/templates/blog_post.html

You can create an app and you can specify blog template in hooks.py of your app.
In bench folder issue:
bench new-app my_blog_template
nano apps/my_blog_template
Add
base_template_map = {
r"blogs.*": "app/templates/blog_template.html"
}
And construct your new template in app/templates/blog_template.html file.
That way you don't change any file in frappe or erpnext. So you are free to upgrade. All customizations will be in your app.
Source: https://frappeframework.com/docs/v13/user/en/python-api/hooks#base-template

Related

I want to export my whole code base like a package or something like a module that I can import

I created an app for a small group of people. I created a lot of widgets/pages and models. Now another group asked if I could make them the app too. I could create a new project and copy/paste al stuff in there, but more groups want this app, and its a lot of work.
My idea was to create something like a package or export the whole code base to another destination, so that I only need to edit one code base and it changes on all app instances. For the new group I only need to change the API URL and some images which can be changed in pub spec.yaml and main.dart. Do you have a working solution for this?
Please read those articles about creating new package:
Flutter Website: link
Tutorial: link
Also, Pay attention to what is the supported platforms in you package and test it with each platform. You can also publish it to Pub.Dev if you want. but must be on GitHub first.

using TYPO3 core hooks only in one site of a multi site installation

i defined a hook in ext_localconf.php:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['typoLink_PostProc']['titleTagsInHiddenText'] = SNM\StmwiAccessibility\ExtendTypolink::class . '->convertTitleInHiddenText';
This hook will be executed on every link on the page, on all pages of all sites. This could be a performance killer ...
So, is there a possibility to restrict the use of the hook to the actual page? Is it possible to get the current site in ext_localconf.php?
e.g.:
$currentSite = ????;
if ($currentsite = 'rootPidOfMySite') {
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']
}
This question rises in other contexts too: i often want to restrict the performance consuming configuration of extensions to one single site. I can do it with the static setup file but not with the stuff in ext_localconf.php.
Thanks!
Which TYPO3 version do you use? There is an API to access the site configuration. I'd say you need to register PSR-15 middleware and then you can access the site configuration. More details can be found in the documentation.

How do you setup Realm with React Native?

SOLVED
After having a lot of struggles here the fastest guide you'll ever find on how to setup a react native app with mongoDB realm. My thanks go to Joe who commented.
Setup the backend. Follow every step of the backend tutorial very carefully. IMPORTANT: In Step E5, use your own name for the app instead of the default. This name cannot be changed!
Setup your app with git clone --branch final https://github.com/mongodb-university/realm-tutorial-react-native.git. Therby you skip the whole frontend tutorial.
Remove the .git folder and rename the project root to complete your takeover.
Note that this example project contains backend functions and a lot of additional stuff on the frontend. Use those as cheat sheet for your implementations. Note that if you want to implement your backend functions using your IDE instead of in the online admincentral you need to do another import using realm-cli. Happy coding!

TYPO3 REST Extension setup

I'm trying to setup the REST-Extension v2 in TYPO3 8.7 following this tutorial. I included the 2 templates called Virtual-Object-Page and Virtual-Object-Content in my template. I made a new extension using Extension Builder 8.7 from Github with a simple model. I installed the new extension and made some Instances of my model in the List View on my start page. In the Typoscript of my template I added:
plugin.tx_rest.settings.paths {
1 {
path = me-kinder-child
read = allow
write = allow
}
}
Me is the Vendor, kinder my extension key and child is my model.
When I'm calling http://localhost/rest/ I get The requested URL /rest/ was not found on this server.
What am I missing?
The path in the setup is explained being possible with several options, so perhaps try different configuration, possible is also all.
I don't see a fault in your setup, so the fault might be related to the server-file .htaccess or the extension realurl respectively the combination of both perhaps.
If you try it already with realurl or cooluri then disable that to get it running without first.
The htaccess file you can disable first too and enable it later again to adjust all requirements to each other.
The problem was not about RealURL was missing in any way. I just did not clear a cache that got cleared while installing RealURL. I guess that the "Clear all caches"-button in the Install-Tool would do it too.

Creating moodle plugin to accept REST calls and create activities/notice/files

Im quite new to moodle development. Im trying to post activity/notice to a selected course. I could not find any webservice for creating activities within a course. Is there any way i could create a plug-in where i could make a REST call to the plug so that it would create a notice?. An example would help allot.
STEP 1
To create local plugin you can follow following folder structure according to Moodle documentation (https://docs.moodle.org/dev/Local_plugins)-
local/
yourplugin/
db/
access.php
install.php
install.xml
lang/
en/
yourplugin.php
index.php
settings.php
version.php
Meanwhile, creating local plugin does not always really solve all problems as there are limitation depending what you really want to achieve.
what worked for me was editing //moodle_dir/course/modedit.php file, and i was able to make REST Call to add scorm activity to any course i want.