RSS   Twitter   Copiny   Copiny
Нашел ошибку? 

Выдели фрагмент текста с ошибкой или неточностью и нажми Ctrl+Enter!

Взаимодействие с глобальными объектами Joomla

Преобразуем пример модуля Hello World! Для этого просто впишем новый php код в соответствующий файл.

<?php
    defined('_JEXEC') or die('Restricted access');
    $user = JFactory::getUser();
    if ($user->guest) {
        echo "<p>Добро пожаловать!</p>";
    } else {
        echo "<p>Имя пользователь: $user->username</p>";
        echo "<p>Пользователь: $user->name</p>";
        echo "<p>E-mail: $user->email</p>";
    }
?>

JFactory - это один из основных классов Joomla, содержащий в себе методы для вызова различных глобальных объектов. В данном примере он возвращает ссылку на объект класса JUser. Выведем с помощью модуля все возможные свойства о пользователе

<?php
    defined('_JEXEC') or die('Restricted access');
    $user = JFactory::getUser();
    print "\n Текущий пользователь \n";
    foreach ($user as $key => $value) {
        if (is_string($value)) {
            print "<p> Свойство пользователя $key = $value</p>\n";
        } else {
            print "<p> Свойство $key - это не строка</p>\n";
        }
    }
?>

Функция is_string() здесь необходима для того чтобы выводить только строковые свойства объекта. С помощью цикла foreach мы перебираем все свойства класса.

В качестве дополнительного примера попробуем использовать класс JURI.

<?php
    defined('_JEXEC') or die('Restricted access');
    $uri = JFactory::getURI();
    print "\nТекущий URI Запрос\n";
    foreach ($uri as $key => $value) {
        if (is_string($value)) {
            print "<p> Свойство $key = $value </p>\n";
        } else {
            print "<p> Свойство $key - не строка </p>\n";
        }
    }
?>

А вот еще один пример с использованием класса для формирования даты и времени - JDate:

<?php
    defined('_JEXEC') or die('Restricted access');
   
    // Получаем дату
    $date = JFactory::getDate();
 
    // Вызов метода toMySQL
    $datemysql = $date->toMySQL();
    echo "\n<p> Дата представлена в формате базы данных MySQL $datemysql </p>\n";
 
    // Используем метод класса toUNIX
    $dateunix = $date->toUNIX();
    echo "\n<p> Текущая дата в UNIX формате - $dateunix </p>\n";
 
    // Используя метод toFormat, преобразуем текущую дату к желаемому виду.
    $datestr = $date->toFormat ('%H:%M:%S - %d %b %Y');
    echo "\n<p> Текущая дата $datestr </p>\n";
 
    // используя внутренний метод _monthToString переведем номер месяца в слово
    echo "\n<p>" . JDate::_monthToString(4) . " or " . $date->_monthToString(4) . "</p>\n";
?>

Смотрите также:
Комментарии (24) Добавить комментарий
  • Артём
    Артём
    26 Декабря 2013, 13:09
     ↑  +1  ↓     ответ

    getUser() есть подскажите как вывести материалы либо из категори либо популярные там вроде document()

  • http://tinyurl.com
    http://tinyurl.com
    24 Ноября 2019, 00:24
     ↑  0  ↓     ответ

    I don't even know how I ended up here, but I thought this post was great.

    I don't know who you are but definitely you are going to a famous blogger if you are not already ;

    ) Cheers!

  • and coconut oil
    and coconut oil
    26 Ноября 2019, 01:28
     ↑  0  ↓     ответ

    obviously like your web site but you have to take a look at the spelling on several of your posts.

    Many of them are rife with spelling problems and

    I in finding it very bothersome to inform the truth however I'll definitely come back

    again.

  • plenty of fish dating site
    plenty of fish dating site
    26 Ноября 2019, 08:17
     ↑  0  ↓     ответ

    Hey there! I just wanted to ask if you ever have any

    trouble with hackers? My last blog (wordpress) was hacked and

    I ended up losing months of hard work due to no back up.

    Do you have any methods to protect against hackers?

  • plenty of fish dating site
    plenty of fish dating site
    27 Ноября 2019, 00:30
     ↑  0  ↓     ответ

    I go to see day-to-day some web sites and information sites to read content, but this weblog gives feature based

    writing.

  • http://tinyurl.com
    http://tinyurl.com
    26 Марта 2022, 15:20
     ↑  0  ↓     ответ

    Nice post. I learn something new and challenging on websites I stumbleupon everyday.

    It will always be useful to read content from other writers and use a little something from other sites.

  • tinyurl.com
    tinyurl.com
    27 Марта 2022, 04:52
     ↑  0  ↓     ответ

    Can I simply just say what a relief to find somebody that really understands what they're

    discussing on the web. You definitely realize how to bring an issue to light and make it important.

    More and more people have to check this out and understand this

    side of the story. I can't believe you're not more popular given that you certainly have the gift.

  • tinyurl.com
    tinyurl.com
    27 Марта 2022, 08:54
     ↑  0  ↓     ответ

    Excellent blog you have here but I was wondering

    if you knew of any community forums that cover the same topics talked about in this article?

    I'd really love to be a part of online community

    where I can get suggestions from other experienced individuals that share the same interest.

    If you have any suggestions, please let me know.

    Bless you!

  • tinyurl.com
    tinyurl.com
    31 Марта 2022, 08:04
     ↑  0  ↓     ответ

    Good day! I know this is somewhat off topic but I was wondering which blog platform are you using for this site?

    I'm getting tired of Wordpress because I've had problems with

    hackers and I'm looking at alternatives for another platform.

    I would be awesome if you could point me in the direction of a good platform.

  • http://tinyurl.com/y8nzud99
    http://tinyurl.com/y8nzud99
    31 Марта 2022, 23:15
     ↑  0  ↓     ответ

    I blog often and I seriously thank you for your

    information. This great article has truly peaked my interest.

    I am going to book mark your blog and keep checking for new details about

    once a week. I subscribed to your RSS feed as well.

  • cheap fly
    cheap fly
    02 Апреля 2022, 16:48
     ↑  0  ↓     ответ

    Hi there! I could have sworn I've been to this blog before but after browsing

    through some of the post I realized it's new to me. Anyways,

    I'm definitely delighted I found it and I'll be book-marking

    and checking back frequently!

  • flights
    flights
    02 Апреля 2022, 23:30
     ↑  0  ↓     ответ

    I do trust all of the ideas you have introduced

    on your post. They're very convincing and will definitely work.

    Nonetheless, the posts are too brief for newbies.

    May just you please lengthen them a little from next time?

    Thanks for the post.

  • cheap flights now
    cheap flights now
    03 Апреля 2022, 11:41
     ↑  0  ↓     ответ

    I simply couldn't go away your website prior to suggesting that I really loved the standard info a person supply for your guests?

    Is going to be back frequently to investigate cross-check new posts

  • cheapest airline tickets guaranteed
    cheapest airline tickets guaranteed
    04 Апреля 2022, 04:49
     ↑  0  ↓     ответ

    It's very easy to find out any matter on net as compared to books,

    as I found this post at this web page.

  • flights tickets cheap
    flights tickets cheap
    04 Апреля 2022, 13:13
     ↑  0  ↓     ответ

    Fantastic beat ! I would like to apprentice even as you amend your site,

    how could i subscribe for a blog site? The account aided me a appropriate deal.

    I were a little bit acquainted of this your broadcast offered vivid clear concept

  • super cheap flights
    super cheap flights
    04 Апреля 2022, 13:23
     ↑  0  ↓     ответ

    A fascinating discussion is worth comment. I do believe that you should

    publish more about this topic, it might not be a taboo subject but generally people

    don't talk about these topics. To the next! Many thanks!!

  • cheap flights domestic
    cheap flights domestic
    05 Апреля 2022, 04:46
     ↑  0  ↓     ответ

    Whats up are using Wordpress for your blog platform?

    I'm new to the blog world but I'm trying to get started and set up my own. Do you need

    any coding knowledge to make your own blog? Any help would be

    greatly appreciated!

  • extremely cheap flight tickets
    extremely cheap flight tickets
    05 Апреля 2022, 06:44
     ↑  0  ↓     ответ

    Thanks for sharing your thoughts. I really appreciate your efforts and I am waiting for your next write ups thanks once

    again.

  • how to find cheap flights
    how to find cheap flights
    05 Апреля 2022, 14:20
     ↑  0  ↓     ответ

    My programmer is trying to convince me to move to .net from PHP.

    I have always disliked the idea because of the expenses.

    But he's tryiong none the less. I've been using Movable-type on a

    number of websites for about a year and am worried about switching to another platform.

    I have heard excellent things about blogengine.net.

    Is there a way I can transfer all my wordpress posts into it?

    Any kind of help would be really appreciated!

  • absolutely cheapest airfare possible
    absolutely cheapest airfare possible
    05 Апреля 2022, 20:38
     ↑  0  ↓     ответ

    Do you have a spam issue on this blog; I also am a blogger, and I was curious

    about your situation; many of us have created some nice practices and we are looking to trade techniques with others,

    be sure to shoot me an e-mail if interested.

  • tracfone special coupon 2022
    tracfone special coupon 2022
    30 Ноября 2022, 13:13
     ↑  0  ↓     ответ

    Spot on with this write-up, I honestly believe that this amazing site needs much more attention. I'll probably be back again to read more,

    thanks for the info!

  • tracfone special coupon 2022
    tracfone special coupon 2022
    01 Декабря 2022, 06:55
     ↑  0  ↓     ответ

    I simply couldn't leave your site prior to suggesting that

    I really enjoyed the standard info an individual provide on your guests?

    Is going to be back often in order to investigate cross-check new posts

  • Victor
    Victor
    28 Января 2023, 09:44
     ↑  0  ↓     ответ

    Hello joomla-book.ru webmaster, Thanks for the well-structured and well-presented post!

  • Micki
    Micki
    05 Июня 2025, 18:30
     ↑  0  ↓     ответ

    The examine additionally highlighted the

    lack of consensus among treating physicians relating to the administration of AAS-induced antagonistic effects.

    The use of AAS can result in numerous well being consequences, including cardiovascular problems, hormonal

    imbalances, liver damage, musculoskeletal points,

    psychiatric effects, and skin problems. AAS abuse also can lead to addiction, with people experiencing withdrawal symptoms when they

    try to reduce or quit utilizing steroids. Repeated and

    extended use of AAS can disrupt pure hormonal balances and end

    in irreversible side effects. When wanting at the direct features and traits of Anavar, an important revolve around its ability to increase nitrogen retention in the muscle, decrease SHBG and

    inhibit glucocorticoid hormones. The enhance in nitrogen retention will promote the anabolic ambiance as lowered ranges usually

    lead to a catabolic state.

    Each efficient steroid stack starts with a stable basis — and meaning selecting the best base compound.

    Your base determines the hormonal setting for the complete cycle and influences every little thing

    from recovery and libido to mood and energy. The testosterone PCT Stack is

    a superb stack for these trying to supercharge their testosterone in a rapid,

    safe way. Just as with traditional anabolics like Sustanon, this stack

    provides you with all the advantages of elevated hormone levels.

    There are plenty of companies out there promising the moon and the celebs with some authorized steroids, guaranteeing significant efficiency increases however

    not having the ability to reside up to these expectations.

    Imagine with the power to pack on pound after pound of lean muscle mass (legit

    lean muscle mass) faster than you ever thought possible. Imagine having the power to assure

    that each moment pushing iron within the fitness center was going to construct

    an even bigger, sooner, stronger you.

    Whereas the struggle towards doping in sports activities is an ongoing

    battle, progress has been made lately. Athletes found guilty of doping offenses face extreme penalties, including bans from competitors and the tarnishing of their reputations.

    Efforts to coach athletes concerning the dangers and consequences of PED use are also being

    intensified, with the goal of selling clean and drug-free sports.

    The problem of doping in sports and the use of performance-enhancing medication (PEDs) continues to be a significant concern in the world of

    athletics. The need to achieve a aggressive edge has led some athletes to resort to doping, jeopardizing the integrity of honest play and

    the health of athletes.

    Authorities warn there are vital security risks in buying steroids, chemical substances, and different illicit products on the Web.

    Many firms involved in these gross sales are operating illegally each in the U.S.

    and China. Federal brokers report that many underground steroid

    labs are extremely unsanitary, with large quantities of raw materials

    being mixed in bathtubs and toilet sinks. Anabolic-androgenic

    steroids (AAS) are lab-made testosterone supplements.

    They’re never a good choice for building muscle tissue or strength due

    to their numerous negative unwanted aspect effects.

    DMAA has been found in quite a few muscle-building and weight reduction supplements, but it’s not

    safe.

    Females will use HGH for a variety of reasons – either for

    its skin and anti-aging advantages and higher sleep or for correct

    fitness and physique outcomes. Girls can anticipate comparable outcomes and

    outcomes to male users of HGH when it comes to rejuvenation, recovery,

    and fat loss. The healing, repair, and development of connective tissue is a facet of

    HGH that makes it interesting to those with out an interest in bodybuilding.

    These potential anti-aging effects have led many to suppose HGH

    might be helpful in slowing down some inevitable declines in collagen production as

    we age. Recovery will be enhanced significantly, while

    tendons, joints, and ligaments can strengthen, making them much

    less prone to harm and supporting more intensive, heavier exercises.

    In conclusion, the current statistics and information surrounding anabolic steroid utilization in 2023 reveal a concerning

    development of abuse, significantly among young populations.

    A research investigating the management of AAS-induced antagonistic effects highlighted a lack of consensus amongst treating physicians, indicating the necessity

    for additional research and standardized protocols.

    My vitality levels skyrocketed, my endurance levels skyrocketed, and my spouse undoubtedly observed a few massive

    "performance enhancements" from utilizing this Improve complement,

    too. I got here away tremendous impressed with this plant-based choice and haven't any

    hassle in any way recommending it to anybody that actually needs to take their exercises to the following stage without risking

    their health at the identical time. If you are on the lookout for top quality Anavar, you'll need to put some effort and time into your search.

    You shouldn't make a buy order on the idea of the product

    being provided, however rather search out independent evaluations

    on the model and provider in question.

    Moreover, by strategically combining compounds, customers may be able to obtain their

    desired results more efficiently and effectively, making essentially the most out of their Anavar

    cycle. It is essential to acknowledge that repeated and extended use

    of anabolic steroids can disrupt natural hormonal balances and lead to

    irreversible unwanted effects. Individuals considering or currently utilizing AAS ought

    to concentrate on the potential long-term penalties and make informed decisions relating to their well being and well-being.

    It is important to notice that the sale and

    distribution of anabolic steroids are regulated

    in most international locations as a outcome of their potential well being

    risks and misuse. However, illicit sales and underground markets continue to thrive, supplying people who search to boost their

    bodily performance or alter their body composition illegally.

    Publish Cycle Therapy is the process of stopping

    a steroid cycle, shedding stored muscle mass, and re-building lean muscle.

    This requires utilizing HGH for a quantity of

    months to maximise its full potential. Actual, pure-quality HGH cannot be produced in underground labs

    as a outcome of large costs and complexity. Nonetheless, many Chinese labs seem like manufacturing high-quality HGH, which is bought as generic.

    Shopping For from such labs is a big gamble; you’ll need to know the supply before handing over money.

    Water retention and swelling are side effects many anabolic steroid users

    will be conversant in. The wrists and ankles are mostly affected by water retention, resulting in a noticeable swelling of those areas, which might hamper your motion.

Оставить комментарий




* обязательно для заполнения

1 введенный почтовый адрес используется только для обратной связи при ответах в комментариях и сервиса gravatar.com
.