Rendering a template in Symfony2 Console application - symfony

I am using Symfony 2.8 and I want to render a template in a Symfony Console application. Basically I can render the template but it is trying to fetch assets from file protocol. I need those assets to be fetched from http protocol in order to creating a pdf from that template. I did try scopes but it did not work.
Actually the question is that I want the template to be rendered with correct asset and image urls. I want to get fully rendered html.

Related

Drupal Mail Programmatically - Tutorial Needed

All!
As the title says, I am new to deal with Drupal and I need to make a module that sends emails whose content is based on HTML and preferably using Twig templates. At the same time, these messages are sent by triggering them through restful web services.
I know how to create a custom module, but I have not dealt with Twig templates and I do not know how to read them in the code and how I can inject data into their placeholders.
I have read about some ways to send e-mails programmatically through Drupal and I did not understand well. An example of this is the use of the hook_mail(). What I understood is that I have to make a custom module and then use this function with the word hook replaced with the name of the module and then make a function that uses the mail manager in Drupal \Drupal::service('plugin.manager.mail'), but what I don't understand is where to put that hook_mail() function inside the custom module?!!! Is it in a PHP file inside The src folder and where is inside the src folder?!!!. What I know is that if I make a special Form that I have to put its PHP file inside the Forms folder, which is inside the src folder. So where do I put it? Is the mail manager, \Drupal::service('plugin.manager.mail'), inside Drupal built internally or is it an external plug-in that has to be installed? Does it support HTML messages?
Best Regards,
Amr Rashad

Is there a way to access Doctrine repositories from stand-alone code?

I have a Symfony 4 app which is complete and working. Any uploaded files are put inside an upload folder outside the doc root and accessed via a separate cdn url.
Inside the upload folder I have a htaccess file that redirects any request, let’s say for example an image, to a php file which then serves the image.
What I want to be able to do is send an auth key along with the image request so that the standalone index.php file can check the user is valid from the database.
This means I need some way of accessing the symfony entity manager from outside of symfony, by including it. The other option would be a curl request to a symfony controller, but I’d rather not add additional network requests if possible. The third option is a separate pdo direct to the database and make sql queries... but again I’d prefer to use the symfony entity manager by including symfony somehow so I can use other features if needed.
I actually tried including the symfony bootstrap in the index.php but that then drags in the need for routing to work which isn’t needed in this case.
You can access EntityManager like that:
require __DIR__.'/../vendor/autoload.php';
(new Dotenv())->load(__DIR__.'/../.env');
$kernel = new Kernel('dev', true);
$kernel->boot();
$user = $kernel->getContainer()->get('doctrine.orm.entity_manager')->getRepository(Repo::class)->find(id);
dd($user->getRoles());

Rails: prevent a css file from being added to asset pipeline

We're accessing a 3rd-party iFrame (dialog) in our web app. This is loaded by javascript and served via the 3rd-party's server. If we provide them with a link to a custom CSS file we can change the appearance of the dialog.
How, in the Rails pipeline, can we create this file and then provide the 3rd-party with a URL that will, hopefully, respect (read: use) our CDN?
Does the file belong in vendor/assets/stylesheets/? I'm pretty sure that becomes part of asset pipeline as well...
Thoughts?

Antaris RazorEngine How to Recompile a template using the same Key?

I'm using Antaris RazorEngine inside a sharepoint webpart to display and render my data using razor, to completely separate the backend from the frontend styling and avoid the need to recompile my component.
I make the template key the same as the file name, Then check
If the web application is in debug mode, or the template isn't cached >>Then
I recompile the template
The problem happens, when I try to call "RunCompile" using the same key, which is the razor file name, I get an exception that there's a template already using the same Key.
What I need to do is to delete the cached template, recompile and cache it to reflect the changes made to the razor template code.
How to Delete a Cached template?
Or How to overwrite or recompile a cached template?

Display Error in Oracle Apex Application

I have exported my oracle apex application and install on another computer. I used css file written by me on my application and also i have change some settings in Theme that i have used for my application. I have exported and installed that css file and theme also. but when i run my application, it is not display correctly. it display only Texts and Images that i have used in application. Theme is missing. but my Login page is display correctly. because it is not using my Template. Login page using Login Template in oracle apex. after logged, when i browse other pages in my application, they are not displaying correctly. Theme is missing on those pages.
The issue is with my Template. but i have imported it in to apex application.
How could i solve this ?
UPDATED
When i open the Developer Tools in my browser(chrome), in Matched CSS Rules section in Elements Tab, display only user agent stylesheet. there is no my stylesheet.
Check your theme templates you changed and see if they are really correct and contain the reference to your custom stylesheet(s)
Check the output of a page you know should have the stylesheet reference
Where do you store the stylesheet? Workspace files, Application files, or simply in the "/i/" (#IMAGE_PREFIX#) folder?
if the latter: did you copy over your stylesheet and is it in the correct location? You say you imported the application to another computer, so you might have simply forgotten to copy over those files.
What is your Apex version ?
How do you load your CSS files ? They are stored on the server (accessible using the image prefix #IMAGE_PREFIX#), loaded into the database (accessible using #WORKSPACE_IMAGES#) or stored on an external server (accessible using the full URL) ?
When you say "install on another computer", you mean load your application into another apex installation right ? Then are you sure the server is configured as the other one (especially image prefix) ?
Have you checked that templates are the same in the two applications ?
Use the console in Chrome or Firefox to check if there are any errors on your page, such as CSS files that can't be loaded.

Resources