I want to pass some value in phtml file to another phtml file somewhere else
as an example 1.phtml file like below
<?php
$inputMessage = 'Hello World';
Mage::getSingleton('core/session')->setWelcomeMessage($inputMessage);
?>
and 2.phtml file like below
<?php
$outputMessage = Mage::getSingleton('core/session')->getWelcomeMessage();
echo $this->__($outputMessage);
?>
if I use something like this it will give an error like below
Fatal error: Uncaught Error: Class 'Mage' not found in C:\xamppp\htdocs\iconmirror\app\code\Codazon\Slideshow\view\frontend\templates\slideshow.phtml:92 Stack trace: #0 C:\xamppp\htdocs\iconmirror\vendor\magento\framework\View\TemplateEngine\Php.php(59): include() #1 C:\xamppp\htdocs\iconmirror\vendor\magento\framework\View\Element\Template.php(255): Magento\Framework\View\TemplateEngine\Php->render(Object(Codazon\Slideshow\Block\Widget\Slideshow), 'C:/xamppp/htdoc...', Array) #2 C:\xamppp\htdocs\iconmirror\vendor\magento\framework\View\Element\Template.php(279): Magento\Framework\View\Element\Template->fetchView('C:/xamppp/htdoc...')
3 C:\xamppp\htdocs\iconmirror\vendor\magento\framework\View\Element\AbstractBlock.php(659):
Magento\Framework\View\Element\Template->_toHtml() #4 C:\xamppp\htdocs\iconmirror\vendor\magento\framework\View\Layout.php(542): Magento\Framework\View\Element\AbstractBlock->toHtml() #5 C:\xamppp\htdocs\iconmirror\vendor\magento\framework\View\Layout.php(518): Magento\Framework\View\Layout->_renderB in C:\xamppp\htdocs\iconmirror\app\code\Codazon\Slideshow\view\frontend\templates\slideshow.phtml on line 92
please help me with this im new to magento 2