How do I get the base URL from the feed content?How to programmatically set custom display settings for an RSS feed?Is it currently possible to have Views respect RSS Display settings on a Content Type?How to consume custom fields in RSS feedsPulling WordPress Featured Images using Aggregator to Display ThemHow to controll rss feed in D7?How to Prevent Truncation of RSS Feed Items in Drupal 7?How to dynamically consume external RSS feed and display content Drupal 7 with feeds module?How to import images and body from external source via rss feed?What aggregator element represents the image in a feed?Aggregator with custom RSS field

CPU overheating in Ubuntu 18.04

When is pointing out a person's hypocrisy not considered to be a logical fallacy?

Won 50K! Now what should I do with it

Construct a pentagon avoiding compass use

How do I write a romance that doesn't look obvious

Why does java.time.Period#normalized() not normalize days?

What would be the ideal melee weapon made of "Phase Metal"?

does ability to impeach an expert witness on science or scholarship go too far?

Are lithium batteries allowed in the International Space Station?

What does "Fotze" really mean?

QGIS Linestring rendering curves between vertex

School House Points (Python + SQLite)

Draw 3D Cubes around centre

Chaining Dissonant Whispers via War Caster feat

About the number of real roots

Is killing off one of my queer characters homophobic?

What is temperature on a quantum level?

I quit, and boss offered me 3 month "grace period" where I could still come back

Create dashed intersections with labels using pgfplots and tikz

How to determine port and starboard on a rotating wheel space station?

Is purchasing foreign currency before going abroad a losing proposition?

Is this floating-point optimization allowed?

Why doesn't the Lars family (and thus Luke) speak Huttese as their first language?

Why would an Inquisitive rogue choose to use Insightful Fighting as opposed to using their Cunning Action to Hide?



How do I get the base URL from the feed content?


How to programmatically set custom display settings for an RSS feed?Is it currently possible to have Views respect RSS Display settings on a Content Type?How to consume custom fields in RSS feedsPulling WordPress Featured Images using Aggregator to Display ThemHow to controll rss feed in D7?How to Prevent Truncation of RSS Feed Items in Drupal 7?How to dynamically consume external RSS feed and display content Drupal 7 with feeds module?How to import images and body from external source via rss feed?What aggregator element represents the image in a feed?Aggregator with custom RSS field






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















Basically, I'm using the Aggregator module to import content from an RSS feed. The content is just a bunch of articles. I display this content in a view.



enter image description here



This is my current output, it shows the title and the date in a jcarousel.
The thing I'm missing is the webpage source.


Currently, source url in views will have me a full link like:
https://whatiwant.com/the-article-name-i-dont-want

From the above, all I want to display is:
whatiwant.com



Here are my view settings:
enter image description here



I have tried adding different types of fields but none of them see to return the right value. Is there any way to perhaps strip the whole source url down to the base of it? I was thinking maybe it could be done programmatically however I need someone to point me in the right direction.










share|improve this question






























    1















    Basically, I'm using the Aggregator module to import content from an RSS feed. The content is just a bunch of articles. I display this content in a view.



    enter image description here



    This is my current output, it shows the title and the date in a jcarousel.
    The thing I'm missing is the webpage source.


    Currently, source url in views will have me a full link like:
    https://whatiwant.com/the-article-name-i-dont-want

    From the above, all I want to display is:
    whatiwant.com



    Here are my view settings:
    enter image description here



    I have tried adding different types of fields but none of them see to return the right value. Is there any way to perhaps strip the whole source url down to the base of it? I was thinking maybe it could be done programmatically however I need someone to point me in the right direction.










    share|improve this question


























      1












      1








      1








      Basically, I'm using the Aggregator module to import content from an RSS feed. The content is just a bunch of articles. I display this content in a view.



      enter image description here



      This is my current output, it shows the title and the date in a jcarousel.
      The thing I'm missing is the webpage source.


      Currently, source url in views will have me a full link like:
      https://whatiwant.com/the-article-name-i-dont-want

      From the above, all I want to display is:
      whatiwant.com



      Here are my view settings:
      enter image description here



      I have tried adding different types of fields but none of them see to return the right value. Is there any way to perhaps strip the whole source url down to the base of it? I was thinking maybe it could be done programmatically however I need someone to point me in the right direction.










      share|improve this question
















      Basically, I'm using the Aggregator module to import content from an RSS feed. The content is just a bunch of articles. I display this content in a view.



      enter image description here



      This is my current output, it shows the title and the date in a jcarousel.
      The thing I'm missing is the webpage source.


      Currently, source url in views will have me a full link like:
      https://whatiwant.com/the-article-name-i-dont-want

      From the above, all I want to display is:
      whatiwant.com



      Here are my view settings:
      enter image description here



      I have tried adding different types of fields but none of them see to return the right value. Is there any way to perhaps strip the whole source url down to the base of it? I was thinking maybe it could be done programmatically however I need someone to point me in the right direction.







      views 8 feeds






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 5 at 11:02









      kiamlaluno

      81.5k10 gold badges135 silver badges252 bronze badges




      81.5k10 gold badges135 silver badges252 bronze badges










      asked Jul 5 at 8:09









      Morten HMorten H

      636 bronze badges




      636 bronze badges




















          1 Answer
          1






          active

          oldest

          votes


















          2














          A way to do this would be to override the proprocess function get the domain like this:



          function MY_MODULE_preprocess_views_view_field(&$variables) 
          $field = $variables['field'];

          if ($field->field == 'MY_LINK_FIELD_NAME')
          $url = $variables['field']->getValue($variables['row'])[0];
          $parse = parse_url($url);
          $variables['output'] = $parse['host'];







          share|improve this answer

























          • Hello, thanks for your answer. In the first line <br> $url = 'the url';// E.g google.com/test will have to be dynamic, as the news come from multiple various sites in the feed. Is it possible to use some kind of dynamic token?

            – Morten H
            Jul 5 at 9:11












          • Yes, I'm not exactly sure how views output the data, try to kint($variables) inside the proprocedd to see where the url is, should be something like this, $variables['field_name'][0]['url']

            – Jdrupal
            Jul 5 at 9:14











          • Can you make it work?

            – Jdrupal
            Jul 5 at 9:24











          • Not sure how to use kint, however i tried with $url = $variables['field_link_1'][0]['url']// Get the value dynamically from $variables array. $parse = parse_url($url); $variables['domain'] = $parse['host']; // prints 'google.com' Placed in a preprocess function, didn't seem to work. I got a parse error and a wsod: ParseError: syntax error, unexpected '$parse' (T_VARIABLE) in DrupalCoreExtensionExtension->load() (line 104 of /ho

            – Morten H
            Jul 5 at 9:56











          • You need a semicolon on line 1

            – Jdrupal
            Jul 5 at 10:25













          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "220"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdrupal.stackexchange.com%2fquestions%2f283135%2fhow-do-i-get-the-base-url-from-the-feed-content%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          A way to do this would be to override the proprocess function get the domain like this:



          function MY_MODULE_preprocess_views_view_field(&$variables) 
          $field = $variables['field'];

          if ($field->field == 'MY_LINK_FIELD_NAME')
          $url = $variables['field']->getValue($variables['row'])[0];
          $parse = parse_url($url);
          $variables['output'] = $parse['host'];







          share|improve this answer

























          • Hello, thanks for your answer. In the first line <br> $url = 'the url';// E.g google.com/test will have to be dynamic, as the news come from multiple various sites in the feed. Is it possible to use some kind of dynamic token?

            – Morten H
            Jul 5 at 9:11












          • Yes, I'm not exactly sure how views output the data, try to kint($variables) inside the proprocedd to see where the url is, should be something like this, $variables['field_name'][0]['url']

            – Jdrupal
            Jul 5 at 9:14











          • Can you make it work?

            – Jdrupal
            Jul 5 at 9:24











          • Not sure how to use kint, however i tried with $url = $variables['field_link_1'][0]['url']// Get the value dynamically from $variables array. $parse = parse_url($url); $variables['domain'] = $parse['host']; // prints 'google.com' Placed in a preprocess function, didn't seem to work. I got a parse error and a wsod: ParseError: syntax error, unexpected '$parse' (T_VARIABLE) in DrupalCoreExtensionExtension->load() (line 104 of /ho

            – Morten H
            Jul 5 at 9:56











          • You need a semicolon on line 1

            – Jdrupal
            Jul 5 at 10:25















          2














          A way to do this would be to override the proprocess function get the domain like this:



          function MY_MODULE_preprocess_views_view_field(&$variables) 
          $field = $variables['field'];

          if ($field->field == 'MY_LINK_FIELD_NAME')
          $url = $variables['field']->getValue($variables['row'])[0];
          $parse = parse_url($url);
          $variables['output'] = $parse['host'];







          share|improve this answer

























          • Hello, thanks for your answer. In the first line <br> $url = 'the url';// E.g google.com/test will have to be dynamic, as the news come from multiple various sites in the feed. Is it possible to use some kind of dynamic token?

            – Morten H
            Jul 5 at 9:11












          • Yes, I'm not exactly sure how views output the data, try to kint($variables) inside the proprocedd to see where the url is, should be something like this, $variables['field_name'][0]['url']

            – Jdrupal
            Jul 5 at 9:14











          • Can you make it work?

            – Jdrupal
            Jul 5 at 9:24











          • Not sure how to use kint, however i tried with $url = $variables['field_link_1'][0]['url']// Get the value dynamically from $variables array. $parse = parse_url($url); $variables['domain'] = $parse['host']; // prints 'google.com' Placed in a preprocess function, didn't seem to work. I got a parse error and a wsod: ParseError: syntax error, unexpected '$parse' (T_VARIABLE) in DrupalCoreExtensionExtension->load() (line 104 of /ho

            – Morten H
            Jul 5 at 9:56











          • You need a semicolon on line 1

            – Jdrupal
            Jul 5 at 10:25













          2












          2








          2







          A way to do this would be to override the proprocess function get the domain like this:



          function MY_MODULE_preprocess_views_view_field(&$variables) 
          $field = $variables['field'];

          if ($field->field == 'MY_LINK_FIELD_NAME')
          $url = $variables['field']->getValue($variables['row'])[0];
          $parse = parse_url($url);
          $variables['output'] = $parse['host'];







          share|improve this answer















          A way to do this would be to override the proprocess function get the domain like this:



          function MY_MODULE_preprocess_views_view_field(&$variables) 
          $field = $variables['field'];

          if ($field->field == 'MY_LINK_FIELD_NAME')
          $url = $variables['field']->getValue($variables['row'])[0];
          $parse = parse_url($url);
          $variables['output'] = $parse['host'];








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jul 5 at 11:23

























          answered Jul 5 at 8:48









          JdrupalJdrupal

          2,8003 gold badges9 silver badges29 bronze badges




          2,8003 gold badges9 silver badges29 bronze badges












          • Hello, thanks for your answer. In the first line <br> $url = 'the url';// E.g google.com/test will have to be dynamic, as the news come from multiple various sites in the feed. Is it possible to use some kind of dynamic token?

            – Morten H
            Jul 5 at 9:11












          • Yes, I'm not exactly sure how views output the data, try to kint($variables) inside the proprocedd to see where the url is, should be something like this, $variables['field_name'][0]['url']

            – Jdrupal
            Jul 5 at 9:14











          • Can you make it work?

            – Jdrupal
            Jul 5 at 9:24











          • Not sure how to use kint, however i tried with $url = $variables['field_link_1'][0]['url']// Get the value dynamically from $variables array. $parse = parse_url($url); $variables['domain'] = $parse['host']; // prints 'google.com' Placed in a preprocess function, didn't seem to work. I got a parse error and a wsod: ParseError: syntax error, unexpected '$parse' (T_VARIABLE) in DrupalCoreExtensionExtension->load() (line 104 of /ho

            – Morten H
            Jul 5 at 9:56











          • You need a semicolon on line 1

            – Jdrupal
            Jul 5 at 10:25

















          • Hello, thanks for your answer. In the first line <br> $url = 'the url';// E.g google.com/test will have to be dynamic, as the news come from multiple various sites in the feed. Is it possible to use some kind of dynamic token?

            – Morten H
            Jul 5 at 9:11












          • Yes, I'm not exactly sure how views output the data, try to kint($variables) inside the proprocedd to see where the url is, should be something like this, $variables['field_name'][0]['url']

            – Jdrupal
            Jul 5 at 9:14











          • Can you make it work?

            – Jdrupal
            Jul 5 at 9:24











          • Not sure how to use kint, however i tried with $url = $variables['field_link_1'][0]['url']// Get the value dynamically from $variables array. $parse = parse_url($url); $variables['domain'] = $parse['host']; // prints 'google.com' Placed in a preprocess function, didn't seem to work. I got a parse error and a wsod: ParseError: syntax error, unexpected '$parse' (T_VARIABLE) in DrupalCoreExtensionExtension->load() (line 104 of /ho

            – Morten H
            Jul 5 at 9:56











          • You need a semicolon on line 1

            – Jdrupal
            Jul 5 at 10:25
















          Hello, thanks for your answer. In the first line <br> $url = 'the url';// E.g google.com/test will have to be dynamic, as the news come from multiple various sites in the feed. Is it possible to use some kind of dynamic token?

          – Morten H
          Jul 5 at 9:11






          Hello, thanks for your answer. In the first line <br> $url = 'the url';// E.g google.com/test will have to be dynamic, as the news come from multiple various sites in the feed. Is it possible to use some kind of dynamic token?

          – Morten H
          Jul 5 at 9:11














          Yes, I'm not exactly sure how views output the data, try to kint($variables) inside the proprocedd to see where the url is, should be something like this, $variables['field_name'][0]['url']

          – Jdrupal
          Jul 5 at 9:14





          Yes, I'm not exactly sure how views output the data, try to kint($variables) inside the proprocedd to see where the url is, should be something like this, $variables['field_name'][0]['url']

          – Jdrupal
          Jul 5 at 9:14













          Can you make it work?

          – Jdrupal
          Jul 5 at 9:24





          Can you make it work?

          – Jdrupal
          Jul 5 at 9:24













          Not sure how to use kint, however i tried with $url = $variables['field_link_1'][0]['url']// Get the value dynamically from $variables array. $parse = parse_url($url); $variables['domain'] = $parse['host']; // prints 'google.com' Placed in a preprocess function, didn't seem to work. I got a parse error and a wsod: ParseError: syntax error, unexpected '$parse' (T_VARIABLE) in DrupalCoreExtensionExtension->load() (line 104 of /ho

          – Morten H
          Jul 5 at 9:56





          Not sure how to use kint, however i tried with $url = $variables['field_link_1'][0]['url']// Get the value dynamically from $variables array. $parse = parse_url($url); $variables['domain'] = $parse['host']; // prints 'google.com' Placed in a preprocess function, didn't seem to work. I got a parse error and a wsod: ParseError: syntax error, unexpected '$parse' (T_VARIABLE) in DrupalCoreExtensionExtension->load() (line 104 of /ho

          – Morten H
          Jul 5 at 9:56













          You need a semicolon on line 1

          – Jdrupal
          Jul 5 at 10:25





          You need a semicolon on line 1

          – Jdrupal
          Jul 5 at 10:25

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Drupal Answers!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdrupal.stackexchange.com%2fquestions%2f283135%2fhow-do-i-get-the-base-url-from-the-feed-content%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

          Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

          Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?